mirror of
https://github.com/fish-shell/fish-shell.git
synced 2025-01-20 13:45:00 +08:00
Make the webconfig HTTP server threaded, fixing a Safari hang
Recently Safari seems to hang with fish webconfig. This is apparently because Safari is opening a socket and not writing to it, causing webconfig to hang until the timeout (30 seconds). It's not clear why. Use ThreadingMixIn so that FishConfigTCPServer can handle more than one connection at a time. This fixes the hang under Safari.
This commit is contained in:
parent
fa74dc977b
commit
f25b9f9831
|
@ -865,7 +865,7 @@ class BindingParser:
|
|||
return readable_command + result
|
||||
|
||||
|
||||
class FishConfigTCPServer(SocketServer.TCPServer):
|
||||
class FishConfigTCPServer(SocketServer.ThreadingMixIn, SocketServer.TCPServer):
|
||||
"""TCPServer that only accepts connections from localhost (IPv4/IPv6)."""
|
||||
|
||||
WHITELIST = set(["::1", "::ffff:127.0.0.1", "127.0.0.1"])
|
||||
|
@ -1575,6 +1575,11 @@ def runThing():
|
|||
thread = threading.Thread(target=runThing)
|
||||
thread.start()
|
||||
|
||||
# Safari will open sockets and not write to them, causing potential hangs
|
||||
# on shutdown.
|
||||
httpd.block_on_close = False
|
||||
httpd.daemon_threads = True
|
||||
|
||||
# Select on stdin and httpd
|
||||
stdin_no = sys.stdin.fileno()
|
||||
try:
|
||||
|
|
Loading…
Reference in New Issue
Block a user