e3c3e50
diff -up cherrypy/_cpwsgiserver.py.EINTR cherrypy/_cpwsgiserver.py
e3c3e50
--- cherrypy/_cpwsgiserver.py.EINTR	2006-04-25 03:37:45.000000000 +0200
e3c3e50
+++ cherrypy/_cpwsgiserver.py	2007-11-03 01:14:20.000000000 +0100
e3c3e50
@@ -332,6 +332,22 @@ class CherryPyWSGIServer(object):
e3c3e50
             # notice keyboard interrupts on Win32, which don't interrupt
e3c3e50
             # accept() by default
e3c3e50
             return
e3c3e50
+        except socket.error, x:
e3c3e50
+            if hasattr(errno, "EINTR") and x.args[0] == errno.EINTR:
e3c3e50
+                # I *think* this is right. EINTR should occur when a signal
e3c3e50
+                # is received during the accept() call; all docs say retry
e3c3e50
+                # the call, and I *think* I'm reading it right that Python
e3c3e50
+                # will then go ahead and poll for and handle the signal
e3c3e50
+                # elsewhere. See http://www.cherrypy.org/ticket/707.
e3c3e50
+                return
e3c3e50
+            msg = x.args[1]
e3c3e50
+            if msg in ("Bad file descriptor", "Socket operation on non-socket"):
e3c3e50
+                # Our socket was closed.
e3c3e50
+                return
e3c3e50
+            if msg == "Resource temporarily unavailable":
e3c3e50
+                # Just try again. See http://www.cherrypy.org/ticket/479.
e3c3e50
+                return
e3c3e50
+            raise
e3c3e50
     
e3c3e50
     def stop(self):
e3c3e50
         """Gracefully shutdown a server that is serving forever."""