From a6bbbb2bbea6dac98feff82326346d09dc2b5971 Mon Sep 17 00:00:00 2001 From: "Eric S. Raymond" Date: Sat, 30 Nov 2013 07:31:56 -0500 Subject: [PATCH] Refactoring step: don't uncomditionally spawn a thread... ...immediate mode doesn't need it. --- irkerd | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/irkerd b/irkerd index ddc008c..f7a1adc 100755 --- a/irkerd +++ b/irkerd @@ -683,11 +683,12 @@ class Irker: self.irc.add_event_handler("disconnect", self._handle_disconnect) self.irc.add_event_handler("kick", self._handle_kick) self.irc.add_event_handler("every_raw_message", self._handle_every_raw_message) + self.servers = {} + def thread_launch(self): thread = threading.Thread(target=self.irc.spin) thread.setDaemon(True) self.irc._thread = thread thread.start() - self.servers = {} def logerr(self, errmsg): "Log a processing error." sys.stderr.write("irkerd: " + errmsg + "\n") @@ -872,6 +873,7 @@ if __name__ == '__main__': irker.irc.spin() # FIXME: This mode does not yet terminate else: + irker.thread_launch() try: tcpserver = SocketServer.TCPServer((HOST, PORT), IrkerTCPHandler) udpserver = SocketServer.UDPServer((HOST, PORT), IrkerUDPHandler) -- 2.26.2