FactorioClient: only await awaitable tasks

This commit is contained in:
Fabian Dill 2021-06-25 07:11:06 +02:00
parent 20729242f9
commit 0e32393acb
1 changed files with 8 additions and 5 deletions

View File

@ -30,13 +30,16 @@ async def main():
ctx.server_address = None
ctx.snes_reconnect_address = None
# allow tasks to quit
await ui_task
await factorio_server_task
await ctx.server_task
if ui_task:
await ui_task
if factorio_server_task:
await factorio_server_task
if ctx.server_task:
await ctx.server_task
if ctx.server is not None and not ctx.server.socket.closed:
if ctx.server and not ctx.server.socket.closed:
await ctx.server.socket.close()
if ctx.server_task is not None:
if ctx.server_task:
await ctx.server_task
while ctx.input_requests > 0: # clear queue for shutdown