]> granicus.if.org Git - python/commitdiff
http://bugs.python.org/issue6381
authorKristján Valur Jónsson <kristjan@ccpgames.com>
Fri, 3 Jul 2009 23:07:07 +0000 (23:07 +0000)
committerKristján Valur Jónsson <kristjan@ccpgames.com>
Fri, 3 Jul 2009 23:07:07 +0000 (23:07 +0000)
some platforms may raise ENOTCONN if the stack has disconnected the socket on behalf of the peer.

Lib/SocketServer.py

index 73cd2196761bc9b599b441dc04166964898653e4..08f005b0864de91db3f0314ae867381fc4552b75 100644 (file)
@@ -445,7 +445,12 @@ class TCPServer(BaseServer):
 
     def close_request(self, request):
         """Called to clean up an individual request."""
-        request.shutdown(socket.SHUT_WR)
+        try:
+            #explicitly shutdown.  socket.close() merely releases
+            #the socket and waits for GC to perform the actual close.
+            request.shutdown(socket.SHUT_WR)
+        except socket.error:
+            pass #some platforms may raise ENOTCONN here
         request.close()