mirror of
https://github.com/DJ2LS/FreeDATA
synced 2024-05-14 08:04:33 +00:00
adjusted session closing procedure
This commit is contained in:
parent
d9dd212cab
commit
117aca2555
1 changed files with 14 additions and 4 deletions
|
@ -46,6 +46,7 @@ class ARQSessionISS(arq_session.ARQSession):
|
||||||
},
|
},
|
||||||
ISS_State.ABORTING: {
|
ISS_State.ABORTING: {
|
||||||
FRAME_TYPE.ARQ_STOP_ACK.value: 'transmission_aborted',
|
FRAME_TYPE.ARQ_STOP_ACK.value: 'transmission_aborted',
|
||||||
|
|
||||||
},
|
},
|
||||||
ISS_State.ABORTED: {
|
ISS_State.ABORTED: {
|
||||||
FRAME_TYPE.ARQ_STOP_ACK.value: 'transmission_aborted',
|
FRAME_TYPE.ARQ_STOP_ACK.value: 'transmission_aborted',
|
||||||
|
@ -91,7 +92,7 @@ class ARQSessionISS(arq_session.ARQSession):
|
||||||
retries = retries - 1
|
retries = retries - 1
|
||||||
|
|
||||||
# TODO TEMPORARY TEST FOR SENDING IN LOWER SPEED LEVEL IF WE HAVE TWO FAILED TRANSMISSIONS!!!
|
# TODO TEMPORARY TEST FOR SENDING IN LOWER SPEED LEVEL IF WE HAVE TWO FAILED TRANSMISSIONS!!!
|
||||||
if retries == 8 and isARQBurst and self.speed_level > 0:
|
if retries == 8 and isARQBurst and self.speed_level > 0 and self.state not in [ISS_State.ABORTED, ISS_State.ABORTING]:
|
||||||
self.log("SENDING IN FALLBACK SPEED LEVEL", isWarning=True)
|
self.log("SENDING IN FALLBACK SPEED LEVEL", isWarning=True)
|
||||||
self.speed_level = 0
|
self.speed_level = 0
|
||||||
print(f" CONFIRMED BYTES: {self.confirmed_bytes}")
|
print(f" CONFIRMED BYTES: {self.confirmed_bytes}")
|
||||||
|
@ -155,15 +156,14 @@ class ARQSessionISS(arq_session.ARQSession):
|
||||||
|
|
||||||
# interrupt transmission when aborting
|
# interrupt transmission when aborting
|
||||||
if self.state in [ISS_State.ABORTED, ISS_State.ABORTING]:
|
if self.state in [ISS_State.ABORTED, ISS_State.ABORTING]:
|
||||||
self.event_frame_received.set()
|
#self.event_frame_received.set()
|
||||||
self.send_stop()
|
#self.send_stop()
|
||||||
return
|
return
|
||||||
|
|
||||||
# update statistics
|
# update statistics
|
||||||
self.update_histograms(self.confirmed_bytes, self.total_length)
|
self.update_histograms(self.confirmed_bytes, self.total_length)
|
||||||
self.update_speed_level(irs_frame)
|
self.update_speed_level(irs_frame)
|
||||||
|
|
||||||
|
|
||||||
if self.expected_byte_offset > self.total_length:
|
if self.expected_byte_offset > self.total_length:
|
||||||
self.confirmed_bytes = self.total_length
|
self.confirmed_bytes = self.total_length
|
||||||
elif not fallback:
|
elif not fallback:
|
||||||
|
@ -236,9 +236,19 @@ class ARQSessionISS(arq_session.ARQSession):
|
||||||
self.event_manager.send_arq_session_finished(
|
self.event_manager.send_arq_session_finished(
|
||||||
True, self.id, self.dxcall, False, self.state.name, statistics=self.calculate_session_statistics(self.confirmed_bytes, self.total_length))
|
True, self.id, self.dxcall, False, self.state.name, statistics=self.calculate_session_statistics(self.confirmed_bytes, self.total_length))
|
||||||
|
|
||||||
|
# clear audio out queue
|
||||||
|
self.modem.audio_out_queue.queue.clear()
|
||||||
|
|
||||||
|
# wait for transmit function to be ready before setting event
|
||||||
|
threading.Event().wait(0.100)
|
||||||
|
|
||||||
# break actual retries
|
# break actual retries
|
||||||
self.event_frame_received.set()
|
self.event_frame_received.set()
|
||||||
|
|
||||||
|
# sleep some time for avoiding packet collission
|
||||||
|
threading.Event().wait(self.TIMEOUT_STOP_ACK)
|
||||||
|
self.send_stop()
|
||||||
|
|
||||||
def send_stop(self):
|
def send_stop(self):
|
||||||
stop_frame = self.frame_factory.build_arq_stop(self.id)
|
stop_frame = self.frame_factory.build_arq_stop(self.id)
|
||||||
self.launch_twr(stop_frame, self.TIMEOUT_STOP_ACK, self.RETRIES_CONNECT, mode=FREEDV_MODE.signalling)
|
self.launch_twr(stop_frame, self.TIMEOUT_STOP_ACK, self.RETRIES_CONNECT, mode=FREEDV_MODE.signalling)
|
||||||
|
|
Loading…
Reference in a new issue