From c689b93ee1b95fa1a90b2d2525d6f2c8596a4955 Mon Sep 17 00:00:00 2001 From: Pedro Date: Wed, 6 Dec 2023 11:47:47 +0100 Subject: [PATCH] Improve ARQ tests and log messages --- modem/arq_session.py | 3 ++- modem/arq_session_iss.py | 6 ++---- tests/test_arq_session.py | 3 ++- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/modem/arq_session.py b/modem/arq_session.py index f6450cc9..7653140c 100644 --- a/modem/arq_session.py +++ b/modem/arq_session.py @@ -12,7 +12,7 @@ class ARQSession(): ] SIZE_BY_SPEED = [ - + ] def __init__(self, config: dict, tx_frame_queue: queue.Queue, dxcall: str): @@ -32,6 +32,7 @@ class ARQSession(): return self.MODE_BY_SPEED[speed_level] def transmit_frame(self, frame: bytearray): + self.logger.info("Transmitting frame") modem_queue_item = { 'mode': self.get_mode_by_speed_level(self.speed_level), 'repeat': 1, diff --git a/modem/arq_session_iss.py b/modem/arq_session_iss.py index c44cd396..20e30b8a 100644 --- a/modem/arq_session_iss.py +++ b/modem/arq_session_iss.py @@ -34,11 +34,8 @@ class ARQSessionISS(arq_session.ARQSession): def generate_id(self): return random.randint(1,255) - def log(self, message): - pass - def set_state(self, state): - self.log(f"ARQ Session {self.id} state {self.state}") + self.logger.info(f"ARQ Session {self.id} state {self.state}") self.state = state def runner(self): @@ -59,6 +56,7 @@ class ARQSessionISS(arq_session.ARQSession): retries = self.RETRIES_CONNECT while retries > 0: self.transmit_frame(connect_frame) + self.logger.info("Waiting for CONN ACK...") if self.event_connection_ack_received.wait(self.TIMEOUT_CONNECT_ACK): self.setState(self.STATE_CONNECTED) return True diff --git a/tests/test_arq_session.py b/tests/test_arq_session.py index deda3b93..5a67f82c 100644 --- a/tests/test_arq_session.py +++ b/tests/test_arq_session.py @@ -52,7 +52,8 @@ class TestARQSession(unittest.TestCase): frame_bytes = bytes(transmission_item['frame']) if random.randint(0, 100) < self.loss_probability: self.logger.info("Frame lost...") - next + continue + self.logger.info("Redirecting frame") frame_dispatcher.new_process_data(frame_bytes, None, len(frame_bytes), 0, 0) def establishChannels(self):