From 28c9985f087d883b8fee5c5be54711eb3cf20b21 Mon Sep 17 00:00:00 2001 From: "Eric S. Raymond" Date: Thu, 4 Oct 2012 14:35:09 -0400 Subject: [PATCH] Arrange to restart dead delivery threads. --- irkerd | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/irkerd b/irkerd index 36cd9b1..9ffa945 100755 --- a/irkerd +++ b/irkerd @@ -117,9 +117,7 @@ class Connection: self.channel_limits = {} # The consumer thread self.queue = Queue.Queue() - self.thread = threading.Thread(target=self.dequeue) - self.thread.setDaemon(True) - self.thread.start() + self.thread = None def nickname(self, n=None): "Return a name for the nth server connection." if n is None: @@ -160,6 +158,10 @@ class Connection: self.status = "ready" def enqueue(self, channel, message): "Enque a message for transmission." + if self.thread is None or not self.thread_is_alive(): + self.thread = threading.Thread(target=self.dequeue) + self.thread.setDaemon(True) + self.thread.start() self.queue.put((channel, message)) def dequeue(self): "Try to ship pending messages from the queue." -- 2.26.2