From fe08d7165034f1e4cb8fe043b99d6f609dc567d5 Mon Sep 17 00:00:00 2001 From: Joel Bender Date: Thu, 11 May 2017 23:44:40 -0400 Subject: [PATCH] cancel the idle timeout when the socket is closed in the server code --- py27/bacpypes/tcp.py | 6 ++++++ py34/bacpypes/tcp.py | 6 ++++++ 2 files changed, 12 insertions(+) diff --git a/py27/bacpypes/tcp.py b/py27/bacpypes/tcp.py index 304bdb07..262155a3 100644 --- a/py27/bacpypes/tcp.py +++ b/py27/bacpypes/tcp.py @@ -692,6 +692,12 @@ def handle_close(self): if self.flush_task: self.flush_task.suspend_task() + # if there is an idle timeout, cancel it + if self.idle_timeout_task: + if _debug: TCPServerActor._debug(" - canceling idle timeout") + self.idle_timeout_task.suspend_task() + self.idle_timeout_task = None + # tell the director this is gone self.director.del_actor(self) diff --git a/py34/bacpypes/tcp.py b/py34/bacpypes/tcp.py index 04ba977a..f4c1560d 100755 --- a/py34/bacpypes/tcp.py +++ b/py34/bacpypes/tcp.py @@ -692,6 +692,12 @@ def handle_close(self): if self.flush_task: self.flush_task.suspend_task() + # if there is an idle timeout, cancel it + if self.idle_timeout_task: + if _debug: TCPServerActor._debug(" - canceling idle timeout") + self.idle_timeout_task.suspend_task() + self.idle_timeout_task = None + # tell the director this is gone self.director.del_actor(self)