mirror of
https://github.com/python/cpython.git
synced 2025-08-29 05:05:03 +00:00
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.
This commit is contained in:
parent
29103c7b32
commit
a5343ccd28
3 changed files with 10 additions and 1 deletions
|
@ -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()
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue