Add explicit exit command. Some platforms (notably, Windows) do not support graceful process termination with SIGINT signal, this change adds an explicit "exit" command so the server could be stopped gracefully from input command rather than a signal.
diff --git a/tsproxy.py b/tsproxy.py index 2e55aeb..45e4e57 100644 --- a/tsproxy.py +++ b/tsproxy.py
@@ -615,6 +615,7 @@ global REMOVE_TCP_OVERHEAD global port_mappings global server + global must_exit if len(input): ok = False try: @@ -652,6 +653,9 @@ if command[1].lower() == 'mapports' or command[1].lower() == 'all': port_mappings = {} ok = True + elif command[0].lower() == 'exit': + must_exit = True + ok = True if ok: needs_flush = True