commit 520200cd8d8d29181795b17ed6b22acd59af2138 Author: Damian Johnson atagar@torproject.org Date: Mon Apr 11 09:42:40 2016 -0700
Restore ability to reconnect to tor
While rewriting I disabled our ability to reconnect when tor has been restarted. Turns out reason it wasn't working was because we needed a thread safe 'connect and reauthenticate' method. Lack of thread safety was causing our other controller activity to disrupt re-authentication.
All seems to be well now. --- nyx/panel/header.py | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-)
diff --git a/nyx/panel/header.py b/nyx/panel/header.py index 01922ec..998a20d 100644 --- a/nyx/panel/header.py +++ b/nyx/panel/header.py @@ -31,6 +31,7 @@ UPDATE_RATE = 5 # rate in seconds at which we refresh CONFIG = conf.config_dict('nyx', { 'attr.flag_colors': {}, 'attr.version_status_colors': {}, + 'tor.chroot': '', })
@@ -137,22 +138,11 @@ class HeaderPanel(nyx.panel.Panel, threading.Thread): if self._vals.is_connected: return
- # TODO: This is borked. Not quite sure why but our attempt to call - # PROTOCOLINFO fails with a socket error, followed by completely freezing - # nyx. This is exposing two bugs... - # - # * This should be working. That's a stem issue. - # * Our interface shouldn't be locking up. That's an nyx issue. - - return - controller = tor_controller()
try: - controller.connect() - try: - controller.authenticate() # TODO: should account for our chroot + controller.reconnect(chroot_path = CONFIG['tor.chroot']) except stem.connection.MissingPassword: password = self.input_prompt('Controller Password: ')