mirror of
https://github.com/onionshare/onionshare.git
synced 2024-12-25 15:29:42 -05:00
Merge pull request #1416 from SaptakS/fix-chat-shutdown
Adds exception for ConnectionError in chat mode during shutdown
This commit is contained in:
commit
aac8020c3e
@ -361,9 +361,18 @@ class Web:
|
||||
# To stop flask, load http://shutdown:[shutdown_password]@127.0.0.1/[shutdown_password]/shutdown
|
||||
# (We're putting the shutdown_password in the path as well to make routing simpler)
|
||||
if self.running:
|
||||
try:
|
||||
requests.get(
|
||||
f"http://127.0.0.1:{port}/{self.shutdown_password}/shutdown"
|
||||
)
|
||||
except requests.exceptions.ConnectionError as e:
|
||||
# The way flask-socketio stops a connection when running using
|
||||
# eventlet is by raising SystemExit to abort all the processes.
|
||||
# Hence the connections are closed and no response is returned
|
||||
# to the above request. So I am just catching the ConnectionError
|
||||
# to check if it was chat mode, in which case it's okay
|
||||
if self.mode != "chat":
|
||||
raise e
|
||||
|
||||
def cleanup(self):
|
||||
"""
|
||||
|
Loading…
Reference in New Issue
Block a user