mirror of
https://github.com/DJ2LS/FreeDATA
synced 2024-05-14 08:04:33 +00:00
Improve ARQ tests and log messages
This commit is contained in:
parent
9074e8e5eb
commit
c689b93ee1
3 changed files with 6 additions and 6 deletions
|
@ -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,
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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):
|
||||
|
|
Loading…
Reference in a new issue