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:
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."