Skip to content
Snippets Groups Projects
Commit 28c9985f authored by Eric S. Raymond's avatar Eric S. Raymond
Browse files

Arrange to restart dead delivery threads.

parent e1d747dc
No related branches found
No related tags found
No related merge requests found
......@@ -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."
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment