Commit 1815d6a3 authored by anonym's avatar anonym

tor-controlport-filter: deal better with shutdowns and restarts.

parent 65802e21
......@@ -402,6 +402,15 @@ class FilteredControlPortProxyHandler(socketserver.StreamRequestHandler):
)
class FilteredControlPortProxy(socketserver.ThreadingTCPServer):
# So we can restart when the listening port is in TIME_WAIT state
# after an abrupt shutdown.
allow_reuse_address = True
# So all server threads immediately quit when the main thread
# quits.
daemon_threads = True
def main():
parser = argparse.ArgumentParser()
parser.add_argument(
......@@ -431,7 +440,7 @@ def main():
"by the client")
global global_args
global_args = parser.parse_args()
server = socketserver.ThreadingTCPServer(
server = FilteredControlPortProxy(
(global_args.listen_address, global_args.listen_port),
FilteredControlPortProxyHandler
)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment