summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKristján Valur Jónsson <kristjan@ccpgames.com>2009-07-03 23:07:07 (GMT)
committerKristján Valur Jónsson <kristjan@ccpgames.com>2009-07-03 23:07:07 (GMT)
commitb5faac73a44f8c0e86b37e448abcf6bb3c9de523 (patch)
treee65c4109cf303bf31b670b79cc0524c990f2550d
parent9d36fd2acbe618796ecfcb1dd6cb04e9d0f44c8f (diff)
downloadcpython-b5faac73a44f8c0e86b37e448abcf6bb3c9de523.zip
cpython-b5faac73a44f8c0e86b37e448abcf6bb3c9de523.tar.gz
cpython-b5faac73a44f8c0e86b37e448abcf6bb3c9de523.tar.bz2
http://bugs.python.org/issue6381
some platforms may raise ENOTCONN if the stack has disconnected the socket on behalf of the peer.
-rw-r--r--Lib/SocketServer.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/Lib/SocketServer.py b/Lib/SocketServer.py
index 73cd219..08f005b 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()