commit 94cd4204b86a21f21f73c28f40073841269f6503 Author: Damian Johnson atagar@torproject.org Date: Tue Feb 6 10:26:30 2018 -0800
Make Relay iterable to get circuits
Thought is: iterate over relays to get circuits, and iterate over circuits to get streams. --- stem/client/__init__.py | 5 +++++ 1 file changed, 5 insertions(+)
diff --git a/stem/client/__init__.py b/stem/client/__init__.py index 5a9d09e6..3f8507e5 100644 --- a/stem/client/__init__.py +++ b/stem/client/__init__.py @@ -183,6 +183,11 @@ class Relay(object):
return circ
+ def __iter__(self): + with self._orport_lock: + for circ in self._circuits.values(): + yield circ + def __enter__(self): return self