From 7d11ff07bde1a6489e36b0e776d1a735216f8870 Mon Sep 17 00:00:00 2001 From: Alexander Bersenev Date: Fri, 19 Jul 2019 15:58:54 +0500 Subject: [PATCH] cancel all tasks on exit --- mtprotoproxy.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/mtprotoproxy.py b/mtprotoproxy.py index bf13e03..c2ce14f 100755 --- a/mtprotoproxy.py +++ b/mtprotoproxy.py @@ -1365,7 +1365,8 @@ def main(): except KeyboardInterrupt: pass - stats_printer_task.cancel() + for task in asyncio.Task.all_tasks(): + task.cancel() if config.LISTEN_ADDR_IPV4: server_v4.close()