Skip to content

Commit 8311a61

Browse files
committed
[scripts/odmlview] Enable address reuse
When a server is ended the port still seems to be blocked, the server cannot be restarted at the same address until a specific time has passed. Using `allow_reuse_address` on the TCPServer class allows this address re-use directly after a shutdown.
1 parent 4e0452e commit 8311a61

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

odml/scripts/odml_view.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,13 +75,15 @@ def run(port=PORT, extensions=None):
7575

7676
server_address = ('', port)
7777

78+
socketserver.TCPServer.allow_reuse_address = True
7879
with socketserver.TCPServer(server_address, handler) as httpd:
7980
webbrowser.open_new_tab('http://localhost:%s' % port)
8081
try:
8182
print("[Info] The server can be stopped by pressing Ctrl+C")
8283
httpd.serve_forever()
8384
except KeyboardInterrupt:
8485
print("[Info] Received Keyboard interrupt, shutting down")
86+
httpd.shutdown()
8587
httpd.server_close()
8688

8789

0 commit comments

Comments
 (0)