mirror of
https://github.com/DJ2LS/FreeDATA
synced 2024-05-14 08:04:33 +00:00
handle data sent twice
if the ACK frame doesnt receive its destination and data will be resent, we can handle this now.
This commit is contained in:
parent
ec83c16856
commit
0baa544bf0
1 changed files with 13 additions and 3 deletions
|
@ -261,10 +261,20 @@ class DATA():
|
||||||
this is the ideal case because we received all data
|
this is the ideal case because we received all data
|
||||||
'''
|
'''
|
||||||
if not None in static.RX_BURST_BUFFER:
|
if not None in static.RX_BURST_BUFFER:
|
||||||
# then iterate through burst buffer and append data to frame buffer
|
# then iterate through burst buffer and stick the burst together
|
||||||
|
# the temp burst buffer is needed for checking, if we already recevied data
|
||||||
|
temp_burst_buffer = b''
|
||||||
for i in range(0,len(static.RX_BURST_BUFFER)):
|
for i in range(0,len(static.RX_BURST_BUFFER)):
|
||||||
static.RX_FRAME_BUFFER += static.RX_BURST_BUFFER[i]
|
#static.RX_FRAME_BUFFER += static.RX_BURST_BUFFER[i]
|
||||||
# then delete burst buffer
|
temp_burst_buffer += static.RX_BURST_BUFFER[i]
|
||||||
|
|
||||||
|
# if frame buffer ends not with the current frame, we are going to append new data
|
||||||
|
# if data already exists, we received the frame correctly, but the ACK frame didnt receive its destination (ISS)
|
||||||
|
if not static.RX_FRAME_BUFFER.endswith(temp_burst_buffer):
|
||||||
|
static.RX_FRAME_BUFFER += temp_burst_buffer
|
||||||
|
static.RX_BURST_BUFFER = []
|
||||||
|
else:
|
||||||
|
structlog.get_logger("structlog").info("[TNC] ARQ | RX | Frame already received - sending ACK again")
|
||||||
static.RX_BURST_BUFFER = []
|
static.RX_BURST_BUFFER = []
|
||||||
|
|
||||||
# lets check if we didnt receive a BOF and EOF yet to avoid sending ack frames if we already received all data
|
# lets check if we didnt receive a BOF and EOF yet to avoid sending ack frames if we already received all data
|
||||||
|
|
Loading…
Reference in a new issue