From: Guido van Rossum Date: Tue, 15 Jun 1999 22:25:32 +0000 (+0000) Subject: Laurence Tratt notes that the accept() call in get_request() can fail, X-Git-Tag: v1.6a1~1214 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=f2f059458792a4ebf80f0adb7e97823e51e697a9;p=python 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.) --- diff --git a/Lib/SocketServer.py b/Lib/SocketServer.py index fe1402e0b2..1ede68d526 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)