From 7a860379843f108c8b83d46c8ebc7b14d9468b3d Mon Sep 17 00:00:00 2001
From: Martin Teichmann <martin.teichmann@xfel.eu>
Date: Thu, 16 Feb 2023 16:46:54 +0100
Subject: [PATCH] drop package if future is already done

---
 ebpfcat/ethercat.py | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/ebpfcat/ethercat.py b/ebpfcat/ethercat.py
index d0deba9..c2f519d 100644
--- a/ebpfcat/ethercat.py
+++ b/ebpfcat/ethercat.py
@@ -293,8 +293,10 @@ class EtherCat(Protocol):
                     if wkc == 0:
                         future.set_exception(
                             EtherCatError("datagram was not processed"))
-                    else:
+                    elif not future.done():
                         future.set_result(data[start:stop])
+                    else:
+                        print("dropped package")
                 dgrams = []
                 packet = Packet()
 
-- 
GitLab