From: Eric S. Raymond Date: Fri, 5 Oct 2012 15:20:36 +0000 (-0400) Subject: Error message improvement. X-Git-Tag: 1.7~2 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=4b71e8c43be6d22d3471959062aaf56b0915705b;p=irker.git Error message improvement. --- diff --git a/irkerd b/irkerd index 436365c..698aa36 100755 --- a/irkerd +++ b/irkerd @@ -58,7 +58,7 @@ except ImportError: CONNECTION_MAX = 200 green_threads = False -import sys, getopt, urlparse, time, random +import sys, getopt, urlparse, time, random, socket import threading, Queue, SocketServer import irc.client, logging try: @@ -478,16 +478,19 @@ if __name__ == '__main__': sys.exit(0) irker = Irker(debuglevel=debuglvl) irker.debug(1, "irkerd version %s" % version) - tcpserver = SocketServer.TCPServer((HOST, PORT), IrkerTCPHandler) - udpserver = SocketServer.UDPServer((HOST, PORT), IrkerUDPHandler) - for server in [tcpserver, udpserver]: - server = threading.Thread(target=server.serve_forever) - server.setDaemon(True) - server.start() try: - while True: - time.sleep(10) - except KeyboardInterrupt: - raise SystemExit(1) + tcpserver = SocketServer.TCPServer((HOST, PORT), IrkerTCPHandler) + udpserver = SocketServer.UDPServer((HOST, PORT), IrkerUDPHandler) + for server in [tcpserver, udpserver]: + server = threading.Thread(target=server.serve_forever) + server.setDaemon(True) + server.start() + try: + while True: + time.sleep(10) + except KeyboardInterrupt: + raise SystemExit(1) + except socket.error, e: + sys.stderr.write("irkerd: server launch failed: %r\n" % e) # end