Implemented link timeouts and keepalive

This commit is contained in:
Mark Qvist 2018-04-21 16:12:42 +02:00
parent 98a489ee11
commit 260f8bbaf1
4 changed files with 153 additions and 24 deletions

View file

@ -97,6 +97,13 @@ class Transport:
Transport.jobs_locked = False
return sent
@staticmethod
def packet_filter(packet):
if packet.context == RNS.Packet.KEEPALIVE:
return True
if not packet.packet_hash in Transport.packet_hashlist:
return True
@staticmethod
def inbound(raw, interface=None):
while (Transport.jobs_running):
@ -111,7 +118,7 @@ class Transport:
RNS.log(str(interface)+" received packet with hash "+RNS.prettyhexrep(packet.packet_hash), RNS.LOG_DEBUG)
if not packet.packet_hash in Transport.packet_hashlist:
if Transport.packet_filter(packet):
Transport.packet_hashlist.append(packet.packet_hash)
if packet.packet_type == RNS.Packet.ANNOUNCE: