diff options
Diffstat (limited to 'wsgitools')
-rw-r--r-- | wsgitools/scgi/asynchronous.py | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/wsgitools/scgi/asynchronous.py b/wsgitools/scgi/asynchronous.py index ecc27fb..82dec02 100644 --- a/wsgitools/scgi/asynchronous.py +++ b/wsgitools/scgi/asynchronous.py @@ -9,6 +9,7 @@ try: import cStringIO as io except ImportError: import StringIO as io +import errno class SCGIConnection(asyncore.dispatcher): """SCGI connection class used by L{SCGIServer}.""" @@ -228,10 +229,16 @@ class SCGIServer(asyncore.dispatcher): def handle_accept(self): """asyncore interface""" - ret = self.accept() - if ret is not None: - conn, addr = ret - SCGIConnection(self, conn, addr, **self.conf) + try: + ret = self.accept() + except socket.error, err: + # See http://bugs.python.org/issue6706 + if err.args[0] not in (errno.ECONNABORTED, errno.EAGAIN): + raise + else: + if ret is not None: + conn, addr = ret + SCGIConnection(self, conn, addr, **self.conf) def run(self): """Runs the server. It will not return and you can invoke |