summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>1999-06-15 22:25:32 (GMT)
committerGuido van Rossum <guido@python.org>1999-06-15 22:25:32 (GMT)
commitf2f059458792a4ebf80f0adb7e97823e51e697a9 (patch)
tree8c457cf60c86f52c17541d7c0be1a08152ed71cd /Lib
parente55702b024bbb6bc73cf90c22a4d1b5ca4fbc721 (diff)
downloadcpython-f2f059458792a4ebf80f0adb7e97823e51e697a9.zip
cpython-f2f059458792a4ebf80f0adb7e97823e51e697a9.tar.gz
cpython-f2f059458792a4ebf80f0adb7e97823e51e697a9.tar.bz2
Laurence Tratt notes that the accept() call in get_request() can fail,
and suggests putting a try/except around the get_request() call in handle_request(). (All in class TCPServer.)
Diffstat (limited to 'Lib')
-rw-r--r--Lib/SocketServer.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/Lib/SocketServer.py b/Lib/SocketServer.py
index fe1402e..1ede68d 100644
--- a/Lib/SocketServer.py
+++ b/Lib/SocketServer.py
@@ -207,7 +207,10 @@ class TCPServer:
def handle_request(self):
"""Handle one request, possibly blocking."""
- request, client_address = self.get_request()
+ try:
+ request, client_address = self.get_request()
+ except socket.error:
+ return
if self.verify_request(request, client_address):
try:
self.process_request(request, client_address)