From: Alexander van Gessel Date: Mon, 21 Jan 2013 03:04:51 +0000 (+0100) Subject: Ensure connections we consider dead are actually closed X-Git-Tag: 1.17~1 X-Git-Url: http://git.tremily.us/gitweb.cgi?a=commitdiff_plain;h=66fe46ea0f1d24835774939148103577d5a3683d;p=irker.git Ensure connections we consider dead are actually closed Signed-off-by: Eric S. Raymond --- 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"