From 66fe46ea0f1d24835774939148103577d5a3683d Mon Sep 17 00:00:00 2001 From: Alexander van Gessel Date: Mon, 21 Jan 2013 04:04:51 +0100 Subject: [PATCH] Ensure connections we consider dead are actually closed Signed-off-by: Eric S. Raymond --- irkerd | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/irkerd b/irkerd index 36b34ab..71ab42b 100755 --- a/irkerd +++ b/irkerd @@ -264,13 +264,21 @@ class Connection: (exc_type, _exc_value, exc_traceback) = sys.exc_info() self.irker.logerr("exception %s in thread for %s" % \ (exc_type, self.servername)) + + # Maybe this should have its own status? + self.status = "expired" + # This is so we can see tracebacks for errors inside the thread # when we need to be able to for debugging purposes. if debuglvl > 0: raise exc_type, _exc_value, exc_traceback - else: - # Maybe this should have its own status? - self.status = "expired" + finally: + try: + # Make sure we don't leave any zombies behind + self.connection.close() + except: + # Irclib has a habit of throwing fresh exceptions here. Ignore that + pass def live(self): "Should this connection not be scavenged?" return self.status != "expired" -- 2.26.2