commit 8772dbe20b7a96edaf0011aeffb0fcb9d6e455c8 Author: Damian Johnson atagar@torproject.org Date: Mon Oct 30 16:02:27 2017 -0700
Controller's get_ports method frequently failed to provide local ports
Oops, sometimes tor provides 127.0.0.1 for localhost and other times 0.0.0.0...
>>> GETINFO net/listeners/or 250-net/listeners/or="0.0.0.0:1443" 250 OK
>>> GETINFO net/listeners/control 250-net/listeners/control="127.0.0.1:9051" 250 OK --- stem/control.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/stem/control.py b/stem/control.py index a02c2387..19619190 100644 --- a/stem/control.py +++ b/stem/control.py @@ -1323,7 +1323,7 @@ class Controller(BaseController): and no default was provided """
- return [port for (addr, port) in self.get_listeners(listener_type) if addr == '127.0.0.1'] + return [port for (addr, port) in self.get_listeners(listener_type) if addr in ('127.0.0.1', '0.0.0.0')]
@with_default() def get_listeners(self, listener_type, default = UNDEFINED):