Skip to content

Commit

Permalink
kiss: Simplification: always prepend FEND
Browse files Browse the repository at this point in the history
Since we empty the buffer after each frame, just blindly assume that we
need to add one.  Two adjacent `FEND`s is valid KISS protocol, and if
there was a bit of line noise, this will prevent that from getting mixed
up with our frame.
  • Loading branch information
sjlongland committed May 26, 2024
1 parent 663e71a commit 2d5b34c
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions aioax25/kiss.py
Original file line number Diff line number Diff line change
Expand Up @@ -330,10 +330,9 @@ def _pick_next_tx(self):
# TX queue is empty
return

if not self._tx_buffer.endswith(bytearray([BYTE_FEND])):
self._tx_buffer += bytearray([BYTE_FEND])

self._tx_buffer += bytes(rawframe) + bytearray([BYTE_FEND])
self._tx_buffer += (
bytearray([BYTE_FEND]) + bytes(rawframe) + bytearray([BYTE_FEND])
)
self._tx_future = future

def _receive_frame(self):
Expand Down

0 comments on commit 2d5b34c

Please sign in to comment.