Ticket #1940: network.py.patch

File network.py.patch, 863 bytes (added by martin.langhoff, 14 years ago)
  • network.py

    old new  
    2525import gobject
    2626import ConfigParser
    2727import gconf
     28import ctypes
    2829
    2930from sugar import dispatch
    3031from sugar import env
     
    354355            self._settings.connection.autoconnect = True
    355356            self.Updated(self._settings.get_dict())
    356357            self.save()
     358        try:
     359            # try to flush resolver cache - SL#1940
     360            # ctypes' syntactic sugar does not work
     361            # so we must get the func ptr explicitly
     362            libc = ctypes.CDLL('libc.so.6')
     363            res_init = getattr(libc, '__res_init')
     364            res_init(None)
     365        except:
     366            logging.error('Error calling libc.__res_init')
    357367
    358368    def set_disconnected(self):
    359369        if self._settings.connection.autoconnect: