mirror of
https://github.com/python/cpython.git
synced 2024-11-21 12:59:38 +01:00
gh-120485: Add an override of allow_reuse_port
on classes subclassing socketserver.TCPServer
(GH-120488)
Co-authored-by: Vinay Sajip <vinay_sajip@yahoo.co.uk>
This commit is contained in:
parent
0c0348adbf
commit
192d17c3fd
@ -129,7 +129,8 @@ DEFAULT_ERROR_CONTENT_TYPE = "text/html;charset=utf-8"
|
||||
|
||||
class HTTPServer(socketserver.TCPServer):
|
||||
|
||||
allow_reuse_address = 1 # Seems to make sense in testing environment
|
||||
allow_reuse_address = True # Seems to make sense in testing environment
|
||||
allow_reuse_port = True
|
||||
|
||||
def server_bind(self):
|
||||
"""Override server_bind to store the server name."""
|
||||
|
@ -984,7 +984,8 @@ def listen(port=DEFAULT_LOGGING_CONFIG_PORT, verify=None):
|
||||
A simple TCP socket-based logging config receiver.
|
||||
"""
|
||||
|
||||
allow_reuse_address = 1
|
||||
allow_reuse_address = True
|
||||
allow_reuse_port = True
|
||||
|
||||
def __init__(self, host='localhost', port=DEFAULT_LOGGING_CONFIG_PORT,
|
||||
handler=None, ready=None, verify=None):
|
||||
|
@ -1038,6 +1038,7 @@ class TestTCPServer(ControlMixin, ThreadingTCPServer):
|
||||
"""
|
||||
|
||||
allow_reuse_address = True
|
||||
allow_reuse_port = True
|
||||
|
||||
def __init__(self, addr, handler, poll_interval=0.5,
|
||||
bind_and_activate=True):
|
||||
|
@ -578,6 +578,7 @@ class SimpleXMLRPCServer(socketserver.TCPServer,
|
||||
"""
|
||||
|
||||
allow_reuse_address = True
|
||||
allow_reuse_port = True
|
||||
|
||||
# Warning: this is for debugging purposes only! Never set this to True in
|
||||
# production code, as will be sending out sensitive information (exception
|
||||
|
@ -0,0 +1 @@
|
||||
Add an override of ``allow_reuse_port`` on classes subclassing ``socketserver.TCPServer`` where ``allow_reuse_address`` is also overridden.
|
Loading…
Reference in New Issue
Block a user