From: Kristján Valur Jónsson Date: Fri, 3 Jul 2009 23:07:07 +0000 (+0000) Subject: http://bugs.python.org/issue6381 X-Git-Tag: v2.7a1~841 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b5faac73a44f8c0e86b37e448abcf6bb3c9de523;p=thirdparty%2FPython%2Fcpython.git http://bugs.python.org/issue6381 some platforms may raise ENOTCONN if the stack has disconnected the socket on behalf of the peer. --- diff --git a/Lib/SocketServer.py b/Lib/SocketServer.py index 73cd2196761b..08f005b0864d 100644 --- a/Lib/SocketServer.py +++ b/Lib/SocketServer.py @@ -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()