[tor-commits] [stem/master] Stop canceling asynchronous tasks for reader and event loops

atagar at torproject.org atagar at torproject.org
Thu Jul 16 01:28:59 UTC 2020


commit 163b3b383bc88cc373f9b97f8f458995f09bf498
Author: Illia Volochii <illia.volochii at gmail.com>
Date:   Thu Apr 30 19:29:37 2020 +0300

    Stop canceling asynchronous tasks for reader and event loops
    
    They finish automatically when detect that their controller is not alive.
---
 stem/control.py | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/stem/control.py b/stem/control.py
index 98631428..ff0f3bc1 100644
--- a/stem/control.py
+++ b/stem/control.py
@@ -641,7 +641,6 @@ class BaseController(_BaseControllerSocketMixin):
     self._socket = control_socket
 
     self._asyncio_loop = asyncio.get_event_loop()
-    self._asyncio_loop_tasks = []
 
     self._msg_lock = _MsgLock()
 
@@ -785,9 +784,6 @@ class BaseController(_BaseControllerSocketMixin):
 
     await self._socket.close()
 
-    for task in self._asyncio_loop_tasks:
-      task.cancel()
-
     # Join on any outstanding state change listeners. Closing is a state change
     # of its own, so if we have any listeners it's quite likely there's some
     # work in progress.
@@ -951,7 +947,7 @@ class BaseController(_BaseControllerSocketMixin):
     """
 
     for coroutine in (self._reader_loop(), self._event_loop()):
-      self._asyncio_loop_tasks.append(self._asyncio_loop.create_task(coroutine))
+      self._asyncio_loop.create_task(coroutine)
 
   async def _reader_loop(self) -> None:
     """





More information about the tor-commits mailing list