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