[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[minion-cvs] Make minion pass all its test cases on win32



Update of /home/minion/cvsroot/src/minion/lib/mixminion/server
In directory moria.mit.edu:/tmp/cvs-serv19208/lib/mixminion/server

Modified Files:
	MMTPServer.py 
Log Message:
Make minion pass all its test cases on win32

Index: MMTPServer.py
===================================================================
RCS file: /home/minion/cvsroot/src/minion/lib/mixminion/server/MMTPServer.py,v
retrieving revision 1.42
retrieving revision 1.43
diff -u -d -r1.42 -r1.43
--- MMTPServer.py	8 Jul 2003 19:13:50 -0000	1.42
+++ MMTPServer.py	10 Jul 2003 21:16:05 -0000	1.43
@@ -43,6 +43,12 @@
 warn = LOG.warn
 error = LOG.error
 
+#DOCDOC
+IN_PROGRESS_ERRNOS = [ getattr(errno, ename) 
+   for ename in [ "EINPROGRESS", "WSAEWOULDBLOCK"]
+   if hasattr(errno,ename) ]
+del ename
+
 class AsyncServer:
     """AsyncServer is the core of a general-purpose asynchronous
        select-based server loop.  AsyncServer maintains two lists of
@@ -73,6 +79,12 @@
 
         readfds = self.readers.keys()
         writefds = self.writers.keys()
+ 
+        if not (readfds or writefds):
+            #DOCDOC
+            time.sleep(timeout)
+            return
+   
         try:
             readfds,writefds,exfds = select.select(readfds,writefds,[],timeout)
         except select.error, e:
@@ -787,8 +799,8 @@
             sock.connect((ip, port))
         except socket.error, e:
             # This will always raise an error, since we're nonblocking.  That's
-            # okay... but it had better be EINPROGRESS.
-            if e[0] != errno.EINPROGRESS:
+            # okay... but it had better be EINPROGRESS or the local equivalent.
+            if e[0] not in IN_PROGRESS_ERRNOS:
                 raise e
 
         tls = context.sock(sock)