Exemplo n.º 1
0
    def loop():
        global _ReceivingLoop
        global _Contacts
        global _ToIncreaseDelay
        global _LastPingTimeDict
        global _PingDelayDict
        global _ConnectionsDict
        global _CurrentDelay
        _ReceivingLoop = reactor.callLater(1, loop)
        _CurrentDelay = settings.getHTTPDelay()

        for idurl, hostport in _Contacts.items():
            if _ConnectionsDict.has_key(idurl):
                continue

            lasttm = _LastPingTimeDict.get(idurl, 0)
            delay = _PingDelayDict.get(idurl, _CurrentDelay)
            dt = time.time() - lasttm

            if dt < delay:
                continue

            _ConnectionsDict[idurl] = ping(idurl, hostport[0], hostport[1])
            _LastPingTimeDict[idurl] = time.time()

        return _ReceivingLoop
Exemplo n.º 2
0
    def loop():
        global _ReceivingLoop
        global _Contacts
        global _ToIncreaseDelay
        global _LastPingTimeDict
        global _PingDelayDict
        global _ConnectionsDict
        global _CurrentDelay
        _ReceivingLoop = reactor.callLater(1, loop)
        _CurrentDelay = settings.getHTTPDelay()

        for idurl, hostport in _Contacts.items():
            if _ConnectionsDict.has_key(idurl):
                continue

            lasttm = _LastPingTimeDict.get(idurl, 0)
            delay = _PingDelayDict.get(idurl, _CurrentDelay)
            dt = time.time() - lasttm

            if dt < delay:
                continue

            _ConnectionsDict[idurl] = ping(idurl, hostport[0], hostport[1])
            _LastPingTimeDict[idurl] = time.time()

        return _ReceivingLoop