def onSocketConnect(e): timeout = conf.get("server_traffic_timeout", 120)*1000 e.network._message_timeout = False if timeout: e.network._message_timeout_source = ui.register_timer(timeout, check_timeout, e.network) else: e.network._message_timeout_source = None
def onSocketConnect(e): timeout = conf.get("server_traffic_timeout", 120) * 1000 e.network._message_timeout = False if timeout: e.network._message_timeout_source = ui.register_timer( timeout, check_timeout, e.network) else: e.network._message_timeout_source = None
def check_timeout(network): if network._message_timeout: network.raw("PING %s" % network.me) timeout = conf.get("server_death_timeout", 240)*1000 network._message_timeout_source = ui.register_timer(timeout, check_death_timeout, network) return False else: network._message_timeout = True return True # call this function again
def do_announce_reconnect(): if not e.network.status: windows.get_default( e.network).write( "* Will reconnect in %s seconds.." % delay) e.network._reconnect_source = ui.register_timer( delay * 1000, do_reconnect)
def check_timeout(network): if network._message_timeout: network.raw("PING %s" % network.me) timeout = conf.get("server_death_timeout", 240) * 1000 network._message_timeout_source = ui.register_timer( timeout, check_death_timeout, network) return False else: network._message_timeout = True return True # call this function again
def check_death_timeout(network): if network._message_timeout: network.raw("QUIT :Server missing, presumed dead") network.disconnect(error="The server seems to have stopped talking to us") else: network._message_timeout = False timeout = conf.get("server_traffic_timeout", 120)*1000 if timeout: network._message_timeout_source = ui.register_timer(timeout, check_timeout, network) else: network._message_timeout_source = None
def check_death_timeout(network): if network._message_timeout: network.raw("QUIT :Server missing, presumed dead") network.disconnect( error="The server seems to have stopped talking to us") else: network._message_timeout = False timeout = conf.get("server_traffic_timeout", 120) * 1000 if timeout: network._message_timeout_source = ui.register_timer( timeout, check_timeout, network) else: network._message_timeout_source = None
def save_config(): global _save_config_source import conf if _save_config_source: _save_config_source.unregister() _save_config_source = ui.register_timer(3000, conf.save)