diff Lib/SocketServer.py @ 10992:87d3f91e44d4 legacy-trunk

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.)
author Guido van Rossum <guido@python.org>
date Tue, 15 Jun 1999 22:25:32 +0000
parents 7e56d39d0741
children 926cb5a5ee30
line wrap: on
line diff
--- a/Lib/SocketServer.py	Tue Jun 15 20:56:40 1999 +0000
+++ b/Lib/SocketServer.py	Tue Jun 15 22:25:32 1999 +0000
@@ -207,7 +207,10 @@
 
     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)