From 423bd12dd9028123390f41957d4f81a6c0af2732 Mon Sep 17 00:00:00 2001 From: Martin Teichmann <martin.teichmann@xfel.eu> Date: Thu, 23 May 2024 15:22:14 +0100 Subject: [PATCH] fix chunking of serial data --- ebpfcat/serial.py | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/ebpfcat/serial.py b/ebpfcat/serial.py index 8ef0f03..2044fd5 100644 --- a/ebpfcat/serial.py +++ b/ebpfcat/serial.py @@ -81,15 +81,14 @@ class Serial(Device): nonlocal remainder s = remainder size = len(remainder) - while not self.buffer.empty() or size == 0: - if size + len(s) > 22: - remainder = s[22-size:] - yield s[:22-size] + + while True: + remainder = s[22-size:] + yield s[:22-size] + size += len(s) + if (self.buffer.empty() and size > 0) or size > 22: return - else: - yield s - size += len(s) - s = await self.buffer.get() + s = await self.buffer.get() while True: ta = self.transmit_accept -- GitLab