Skip to content

Commit

Permalink
fixup: keep split tunnel error state
Browse files Browse the repository at this point in the history
  • Loading branch information
dlon committed Dec 22, 2022
1 parent 1fa89c9 commit fbe6abb
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
17 changes: 15 additions & 2 deletions talpid-core/src/split_tunnel/windows/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -184,13 +184,18 @@ impl SplitTunnel {
pub fn new(
runtime: tokio::runtime::Handle,
resource_dir: PathBuf,
daemon_tx: Weak<mpsc::UnboundedSender<TunnelCommand>>,
volume_update_rx: mpsc::UnboundedReceiver<()>,
route_manager: RouteManagerHandle,
) -> Result<Self, Error> {
let excluded_processes = Arc::new(RwLock::new(HashMap::new()));

let (request_tx, handle) =
Self::spawn_request_thread(resource_dir, volume_update_rx, excluded_processes.clone())?;
let (request_tx, handle) = Self::spawn_request_thread(
resource_dir,
daemon_tx,
volume_update_rx,
excluded_processes.clone(),
)?;

let (event_thread, quit_event) =
Self::spawn_event_listener(handle, excluded_processes.clone())?;
Expand Down Expand Up @@ -407,6 +412,7 @@ impl SplitTunnel {

fn spawn_request_thread(
resource_dir: PathBuf,
daemon_tx: Weak<mpsc::UnboundedSender<TunnelCommand>>,
volume_update_rx: mpsc::UnboundedReceiver<()>,
excluded_processes: Arc<RwLock<HashMap<usize, ExcludedProcess>>>,
) -> Result<(RequestTx, Arc<driver::DeviceHandle>), Error> {
Expand Down Expand Up @@ -534,6 +540,13 @@ impl SplitTunnel {
}
} else {
log_response = Some(response);

log::debug!(
"Entering error state due to failed request/ioctl: {}",
request_name
);
daemon_tx
.unbounded_send(TunnelCommand::Block(ErrorStateCause::SplitTunnelError));
}
if let Some(Err(error)) = log_response {
log::error!(
Expand Down
1 change: 1 addition & 0 deletions talpid-core/src/tunnel_state_machine/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,7 @@ impl TunnelStateMachine {
let split_tunnel = split_tunnel::SplitTunnel::new(
runtime.clone(),
args.resource_dir.clone(),
args.command_tx.clone(),
volume_update_rx,
route_manager
.handle()
Expand Down

0 comments on commit fbe6abb

Please sign in to comment.