def isConnectionAlive(self, *args, **kwargs):
     # miss = 0
     if driver.is_on('service_udp_datagrams'):
         from lib import udp
         if time.time() - udp.get_last_datagram_time() < 60:
             if settings.enableUDP() and settings.enableUDPreceiving():
                 return True
     # else:
     #     miss += 1
     if driver.is_on('service_gateway'):
         from transport import gateway
         if time.time() - gateway.last_inbox_time() < 60:
             return True
         transport_states = [
             t.state for t in list(gateway.transports().values())
         ]
         if 'LISTENING' in transport_states:
             return True
         if 'STARTING' in transport_states:
             return True
     # else:
     #     miss += 1
     # if miss >= 2:
     #     return True
     # return False ... still testing that approach
     return True
示例#2
0
 def isConnectionAlive(self, arg):
     # miss = 0
     if driver.is_on('service_udp_datagrams'):
         from lib import udp
         if time.time() - udp.get_last_datagram_time() < 60:
             if settings.enableUDP() and settings.enableUDPreceiving():
                 return True
     # else:
     #     miss += 1
     if driver.is_on('service_gateway'):
         from transport import gateway
         if time.time() - gateway.last_inbox_time() < 60:
             return True
         transport_states = map(lambda t: t.state,
                                gateway.transports().values())
         if 'LISTENING' in transport_states:
             return True
         if 'STARTING' in transport_states:
             return True
     # else:
     #     miss += 1
     # if miss >= 2:
     #     return True
     return True  # testing
     return False