Skip to content

Commit

Permalink
Multiserver: cleaner exit (ArchipelagoMW#1743)
Browse files Browse the repository at this point in the history
  • Loading branch information
Berserker66 authored Apr 23, 2023
1 parent 06a25a9 commit 58aea7c
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions MultiServer.py
Original file line number Diff line number Diff line change
Expand Up @@ -1865,7 +1865,7 @@ def _cmd_status(self, tag: str = "") -> bool:

def _cmd_exit(self) -> bool:
"""Shutdown the server"""
async_start(self.ctx.server.ws_server._close())
self.ctx.server.ws_server.close()
if self.ctx.shutdown_task:
self.ctx.shutdown_task.cancel()
self.ctx.exit_event.set()
Expand Down Expand Up @@ -2206,7 +2206,7 @@ async def auto_shutdown(ctx, to_cancel=None):
await asyncio.sleep(ctx.auto_shutdown)
while not ctx.exit_event.is_set():
if not ctx.client_activity_timers.values():
async_start(ctx.server.ws_server._close())
ctx.server.ws_server.close()
ctx.exit_event.set()
if to_cancel:
for task in to_cancel:
Expand All @@ -2217,7 +2217,7 @@ async def auto_shutdown(ctx, to_cancel=None):
delta = datetime.datetime.now(datetime.timezone.utc) - newest_activity
seconds = ctx.auto_shutdown - delta.total_seconds()
if seconds < 0:
async_start(ctx.server.ws_server._close())
ctx.server.ws_server.close()
ctx.exit_event.set()
if to_cancel:
for task in to_cancel:
Expand Down

0 comments on commit 58aea7c

Please sign in to comment.