From 0c23ca05613f2835c7b45f2f2fb2e7f1105e3be0 Mon Sep 17 00:00:00 2001 From: DJ2LS Date: Thu, 2 Nov 2023 15:02:47 +0100 Subject: [PATCH] make channel opener more random --- modem/data_handler.py | 9 ++++++--- modem/static.py | 2 +- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/modem/data_handler.py b/modem/data_handler.py index d661e734..bef01922 100644 --- a/modem/data_handler.py +++ b/modem/data_handler.py @@ -2246,14 +2246,17 @@ class DATA: ) # Let's check if we have a busy channel and if we are not in a running arq session. - if ModemParam.channel_busy and not ARQ.arq_state_event.is_set(): + if ModemParam.channel_busy and not ARQ.arq_state_event.is_set() or ModemParam.is_codec2_traffic: self.channel_busy_handler() # if channel free, enqueue frame for tx - self.enqueue_frame_for_tx([connection_frame], c2_mode=FREEDV_MODE.sig0.value, copies=1, repeat_delay=0) + if not ARQ.arq_state_event.is_set(): + self.enqueue_frame_for_tx([connection_frame], c2_mode=FREEDV_MODE.sig0.value, copies=1, repeat_delay=0) # wait until timeout or event set - ARQ.arq_state_event.wait(timeout=self.datachannel_opening_interval) + + random_wait_time = randrange(int(self.duration_sig1_frame * 10), int(self.datachannel_opening_interval * 10), 5) + ARQ.arq_state_event.wait(timeout=random_wait_time) if ARQ.arq_state_event.is_set(): return True diff --git a/modem/static.py b/modem/static.py index 30042845..373d86dc 100644 --- a/modem/static.py +++ b/modem/static.py @@ -137,7 +137,7 @@ class TCIParam: @dataclass class Modem: - version = "0.11.2-alpha.3" + version = "0.11.2-alpha.4" host: str = "0.0.0.0" port: int = 3000 SOCKET_TIMEOUT: int = 1 # seconds