[tor-commits] [stem/master] Implement public methods of `BaseController` in the synchronous wrapper

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


commit 1e97d19d55f1ebd42dc04c442bb217141299a09d
Author: Illia Volochii <illia.volochii at gmail.com>
Date:   Thu Apr 23 20:58:40 2020 +0300

    Implement public methods of `BaseController` in the synchronous wrapper
---
 stem/control.py | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/stem/control.py b/stem/control.py
index 50dff89f..7d0d517e 100644
--- a/stem/control.py
+++ b/stem/control.py
@@ -3903,6 +3903,9 @@ class Controller(_ControllerClassMethodMixin, _BaseControllerSocketMixin):
   def msg(self, message: str) -> stem.response.ControlMessage:
     return self._execute_async_method('msg', message)
 
+  def is_authenticated(self) -> bool:
+    return self._async_controller.is_authenticated()
+
   def connect(self) -> None:
     self._execute_async_method('connect')
 
@@ -3913,6 +3916,15 @@ class Controller(_ControllerClassMethodMixin, _BaseControllerSocketMixin):
       self._asyncio_thread.join()
     self._asyncio_loop.close()
 
+  def get_latest_heartbeat(self) -> float:
+    return self._async_controller.get_latest_heartbeat()
+
+  def add_status_listener(self, callback: Callable[['stem.control.BaseController', 'stem.control.State', float], None], spawn: bool = True) -> None:
+    self._async_controller.add_status_listener(callback, spawn)
+
+  def remove_status_listener(self, callback: Callable[['stem.control.Controller', 'stem.control.State', float], None]) -> bool:
+    self._async_controller.remove_status_listener(callback)
+
   def __enter__(self) -> 'stem.control.Controller':
     return self
 





More information about the tor-commits mailing list