Esempio n. 1
0
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
Esempio n. 2
0
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
Esempio n. 3
0
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
Esempio n. 4
0
 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)
Esempio n. 5
0
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
Esempio n. 6
0
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
Esempio n. 7
0
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
Esempio n. 8
0
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)