*** asyncore.py.orig Sat Jan 22 11:40:19 2011 --- asyncore.py Sat Jan 22 12:20:22 2011 *************** *** 130,135 **** --- 130,137 ---- try: r, w, e = select.select(r, w, e, timeout) + if r==[] and w==[] and e==[]: + return 0 except select.error, err: if err.args[0] != EINTR: raise *************** *** 199,205 **** if count is None: while map: ! poll_fun(timeout, map) else: while map and count > 0: --- 201,208 ---- if count is None: while map: ! if poll_fun(timeout, map) == 0: ! break else: while map and count > 0: ## ## The code below demonstrates the problem ## ## #!/usr/bin/env python ## import asyncore ## import socket ## ## class EchoServer(asyncore.dispatcher): ## def __init__(self, host, port): ## asyncore.dispatcher.__init__(self) ## self.create_socket(socket.AF_INET, socket.SOCK_STREAM) ## self.set_reuse_addr() ## self.bind((host, port)) ## self.listen(5) ## def handle_accept(self): ## pass ## ## server = EchoServer('localhost', 8080) ## ## Without the patch, this never breaks out of the loop. ## ## print "Enter Loop" ## asyncore.loop(timeout=2.0) ## print "Exit Loop" ##