[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [stem/master] Make `Controller.get_streams` asynchronous



commit 79d07c69d41dacc503ff17bbc87fd5be66750431
Author: Illia Volochii <illia.volochii@xxxxxxxxx>
Date:   Tue Apr 21 22:10:52 2020 +0300

    Make `Controller.get_streams` asynchronous
---
 stem/control.py | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/stem/control.py b/stem/control.py
index 1d4ee689..f63df7bc 100644
--- a/stem/control.py
+++ b/stem/control.py
@@ -3561,7 +3561,7 @@ class Controller(BaseController):
         raise stem.ProtocolError('CLOSECIRCUIT returned unexpected response code: %s' % response.code)
 
   @with_default()
-  def get_streams(self, default: Any = UNDEFINED) -> List[stem.response.events.StreamEvent]:
+  async def get_streams(self, default: Any = UNDEFINED) -> List[stem.response.events.StreamEvent]:
     """
     get_streams(default = UNDEFINED)
 
@@ -3576,10 +3576,10 @@ class Controller(BaseController):
     """
 
     streams = []  # type: List[stem.response.events.StreamEvent]
-    response = self.get_info('stream-status')
+    response = await self.get_info('stream-status')
 
     for stream in response.splitlines():
-      message = stem.response._convert_to_event(stem.socket.recv_message(io.BytesIO(stem.util.str_tools._to_bytes('650 STREAM %s\r\n' % stream))))
+      message = stem.response._convert_to_event(await stem.socket.recv_message(io.BytesIO(stem.util.str_tools._to_bytes('650 STREAM %s\r\n' % stream))))
       streams.append(message)  # type: ignore
 
     return streams



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits