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 73cd219..08f005b 100644
--- a/Lib/SocketServer.py
+++ b/Lib/SocketServer.py
@@ -445,7 +445,12 @@
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()