From 2afcab1747b50cb147e5102571c12eb367f5ad22 Mon Sep 17 00:00:00 2001 From: "Eric S. Raymond" Date: Fri, 19 Oct 2012 17:01:12 -0400 Subject: [PATCH] Remove a mutex guard that is probably unecessary. AI0867 reported this was causing a rare hang during disconnect. Also, set the connection status to expired if the thread terminates due to exception. --- irkerd | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/irkerd b/irkerd index 1bc56f2..ffd8f8f 100755 --- a/irkerd +++ b/irkerd @@ -238,17 +238,16 @@ class Connection: self.status = "expired" break elif self.status == "ready": - with self.irker.irc.mutex: - (channel, message) = self.queue.get() - if channel not in self.channels_joined: - self.connection.join(channel) - self.irker.debug(1, "joining %s on %s." % (channel, self.servername)) - for segment in message.split("\n"): - self.connection.privmsg(channel, segment) - time.sleep(ANTI_FLOOD_DELAY) - self.last_xmit = self.channels_joined[channel] = time.time() - self.irker.debug(1, "XMIT_TTL bump (%s transmission) at %s" % (self.servername, time.asctime())) - self.queue.task_done() + (channel, message) = self.queue.get() + if channel not in self.channels_joined: + self.connection.join(channel) + self.irker.debug(1, "joining %s on %s." % (channel, self.servername)) + for segment in message.split("\n"): + self.connection.privmsg(channel, segment) + time.sleep(ANTI_FLOOD_DELAY) + self.last_xmit = self.channels_joined[channel] = time.time() + self.irker.debug(1, "XMIT_TTL bump (%s transmission) at %s" % (self.servername, time.asctime())) + self.queue.task_done() except: (exc_type, _exc_value, exc_traceback) = sys.exc_info() self.irker.logerr("exception %s in thread for %s" % \ @@ -257,6 +256,9 @@ class Connection: # 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" def live(self): "Should this connection not be scavenged?" return self.status != "expired" -- 2.26.2