Skip to content

Commit

Permalink
MultiServer: properly shutdown even if ctx is invalid
Browse files Browse the repository at this point in the history
  • Loading branch information
black-sliver committed Nov 10, 2024
1 parent 913b4d3 commit a8275ad
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions MultiServer.py
Original file line number Diff line number Diff line change
Expand Up @@ -1960,8 +1960,10 @@ def _cmd_status(self, tag: str = "") -> bool:

def _cmd_exit(self) -> bool:
"""Shutdown the server"""
self.ctx.server.ws_server.close()
self.ctx.exit_event.set()
try:
self.ctx.server.ws_server.close()
finally:
self.ctx.exit_event.set()
return True

@mark_raw
Expand Down

0 comments on commit a8275ad

Please sign in to comment.