Skip to content

Commit

Permalink
fix(comms/tor): re-establish tor control port connection for any fail…
Browse files Browse the repository at this point in the history
…ure (#4446)

Description
---
Retries tor control port connection for any error.

Motivation and Context
---
If any error is encountered with the tor control port connection, the connection is re-established.
Previously, this would only happen if the control port connection is cleanly closed

How Has This Been Tested?
---
Manually
  • Loading branch information
sdbondi authored Aug 11, 2022
1 parent 4f1a4fe commit 6d9ca81
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
2 changes: 2 additions & 0 deletions comms/core/src/tor/control_client/monitor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -105,10 +105,12 @@ where

// Error receiving a line from the control server
Either::Right(Some(Err(err))) => {
cmd_rx.close();
error!(
target: LOG_TARGET,
"Line framing error when reading from tor control server: '{:?}'. Monitor is exiting.", err
);
let _result = event_tx.send(TorControlEvent::TorControlDisconnected);
break;
},
// The control server disconnected
Expand Down
1 change: 1 addition & 0 deletions comms/core/src/tor/hidden_service/controller.rs
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,7 @@ impl HiddenServiceController {
let either = future::select(connect_fut, signal.take().expect("signal was None")).await;
match either {
Either::Left((Ok(client), _)) => {
info!(target: LOG_TARGET, "Connection to tor control port re-established");
self.client = Some(client);
self.authenticate().await?;
self.set_events().await?;
Expand Down

0 comments on commit 6d9ca81

Please sign in to comment.