From c6e9ebdecc6d60eb8f76957a2b68d58f62742b61 Mon Sep 17 00:00:00 2001
From: Bob van de Vijver <bob@drenso.nl>
Date: Wed, 21 Jul 2021 21:42:40 +0200
Subject: [PATCH] Use xmit in ping timeout window to determine broken
 connection correctly

---
 irkerd | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/irkerd b/irkerd
index 969e1fd..7a6912c 100755
--- a/irkerd
+++ b/irkerd
@@ -555,11 +555,12 @@ class Connection:
                     now = time.time()
                     xmit_timeout = now > self.last_xmit + XMIT_TTL
                     ping_timeout = now > self.last_ping + PING_TTL
+                    xmit_in_ping_timeout = self.last_xmit + PING_TTL > self.last_ping
                     if self.status == "disconnected":
                         # If the queue is empty, we can drop this connection.
                         self.status = "expired"
                         break
-                    elif ping_timeout:
+                    elif not xmit_in_ping_timeout and ping_timeout:
                         LOG.info((
                             "timing out connection to %s at %s "
                             "(ping_timeout=%s, xmit_timeout=%s)") % (
-- 
GitLab