summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>2001-10-18 18:02:07 (GMT)
committerGuido van Rossum <guido@python.org>2001-10-18 18:02:07 (GMT)
commita5343ccd28245d96feb21d1457802b97a76aa210 (patch)
tree42cd1031a7b0a2f0a6e53757a134761da0bce6ec /Lib
parent29103c7b32e1c3342bac7a29514c3f033da5458a (diff)
downloadcpython-a5343ccd28245d96feb21d1457802b97a76aa210.zip
cpython-a5343ccd28245d96feb21d1457802b97a76aa210.tar.gz
cpython-a5343ccd28245d96feb21d1457802b97a76aa210.tar.bz2
SF bug #471720: ThreadingMixIn/TCPServer forgets close
Solved with a helper method that calls finish_request() and then close_request(). The code is by Max Neunhöffer.
Diffstat (limited to 'Lib')
-rw-r--r--Lib/SocketServer.py7
1 files changed, 6 insertions, 1 deletions
diff --git a/Lib/SocketServer.py b/Lib/SocketServer.py
index 00064ba..5128e17 100644
--- a/Lib/SocketServer.py
+++ b/Lib/SocketServer.py
@@ -448,10 +448,15 @@ class ForkingMixIn:
class ThreadingMixIn:
"""Mix-in class to handle each request in a new thread."""
+ def process_request_thread(self, request, client_address):
+ """Same as in BaseServer but as a thread."""
+ self.finish_request(request, client_address)
+ self.close_request(request)
+
def process_request(self, request, client_address):
"""Start a new thread to process the request."""
import threading
- t = threading.Thread(target = self.finish_request,
+ t = threading.Thread(target = self.process_request_thread,
args = (request, client_address))
t.start()