Adjusted I2P interface timings

This commit is contained in:
Mark Qvist 2022-11-03 16:30:07 +01:00
parent 1d2a0fe4c8
commit 01e520b082
2 changed files with 6 additions and 5 deletions

View File

@ -383,7 +383,7 @@ class I2PInterfacePeer(Interface):
I2P_PROBE_AFTER = 10 I2P_PROBE_AFTER = 10
I2P_PROBE_INTERVAL = 9 I2P_PROBE_INTERVAL = 9
I2P_PROBES = 5 I2P_PROBES = 5
I2P_READ_TIMEOUT = I2P_PROBE_INTERVAL * I2P_PROBES + I2P_PROBE_AFTER I2P_READ_TIMEOUT = (I2P_PROBE_INTERVAL * I2P_PROBES + I2P_PROBE_AFTER)*2
def __init__(self, parent_interface, owner, name, target_i2p_dest=None, connected_socket=None, max_reconnect_tries=None): def __init__(self, parent_interface, owner, name, target_i2p_dest=None, connected_socket=None, max_reconnect_tries=None):
self.rxb = 0 self.rxb = 0
@ -662,6 +662,8 @@ class I2PInterfacePeer(Interface):
should_run = True should_run = True
try: try:
while should_run and not self.wd_reset: while should_run and not self.wd_reset:
time.sleep(1)
if (time.time()-self.last_write > I2PInterfacePeer.I2P_PROBE_AFTER*0.66): if (time.time()-self.last_write > I2PInterfacePeer.I2P_PROBE_AFTER*0.66):
self.processOutgoing(bytes([0x00])) self.processOutgoing(bytes([0x00]))
@ -680,7 +682,6 @@ class I2PInterfacePeer(Interface):
should_run = False should_run = False
time.sleep(1)
finally: finally:
self.wd_reset = False self.wd_reset = False
@ -709,7 +710,7 @@ class I2PInterfacePeer(Interface):
# Read loop for KISS framing # Read loop for KISS framing
if (in_frame and byte == KISS.FEND and command == KISS.CMD_DATA): if (in_frame and byte == KISS.FEND and command == KISS.CMD_DATA):
in_frame = False in_frame = False
if len(data_buffer > RNS.Reticulum.HEADER_MINSIZE+1): if len(data_buffer) > RNS.Reticulum.HEADER_MINSIZE+1:
self.processIncoming(data_buffer) self.processIncoming(data_buffer)
elif (byte == KISS.FEND): elif (byte == KISS.FEND):
in_frame = True in_frame = True
@ -737,7 +738,7 @@ class I2PInterfacePeer(Interface):
# Read loop for HDLC framing # Read loop for HDLC framing
if (in_frame and byte == HDLC.FLAG): if (in_frame and byte == HDLC.FLAG):
in_frame = False in_frame = False
if len(data_buffer > RNS.Reticulum.HEADER_MINSIZE+1): if len(data_buffer) > RNS.Reticulum.HEADER_MINSIZE+1:
self.processIncoming(data_buffer) self.processIncoming(data_buffer)
elif (byte == HDLC.FLAG): elif (byte == HDLC.FLAG):
in_frame = True in_frame = True

File diff suppressed because one or more lines are too long