summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorEmīls Piņķis <emils@mullvad.net>2019-06-14 15:04:17 +0100
committerEmīls Piņķis <emils@mullvad.net>2019-06-14 15:04:17 +0100
commit1b1603d8e4cef3dcf76b22b9a21ee79ac3670bad (patch)
tree7cf6d93e90cada64f6e3436a7882a5597b854c9d
parentaa2dfdfdd765680e6dbba9a7c7b70eaad797ae42 (diff)
parentb9381c5f60bef73a810453b74f643a0e55f3b447 (diff)
downloadmullvadvpn-1b1603d8e4cef3dcf76b22b9a21ee79ac3670bad.tar.xz
mullvadvpn-1b1603d8e4cef3dcf76b22b9a21ee79ac3670bad.zip
Merge branch 'linux-offline-detection-fail-open'
-rw-r--r--talpid-core/src/offline/linux.rs13
1 files changed, 11 insertions, 2 deletions
diff --git a/talpid-core/src/offline/linux.rs b/talpid-core/src/offline/linux.rs
index a5f35896a9..e387062d2d 100644
--- a/talpid-core/src/offline/linux.rs
+++ b/talpid-core/src/offline/linux.rs
@@ -189,11 +189,15 @@ fn monitor_event_loop(
})
.map_err(|_| Error::MonitorNetlinkError);
- connection
+ // Under normal circumstances, this runs forever.
+ let result = connection
.map_err(Error::NetlinkError)
.join(monitor)
.wait()
- .map(|_| ())
+ .map(|_| ());
+ // But if it fails, it should fail open.
+ link_monitor.reset();
+ result
}
struct LinkMonitor {
@@ -220,4 +224,9 @@ impl LinkMonitor {
.unbounded_send(TunnelCommand::IsOffline(is_offline));
}
}
+
+ /// Allow the offline check to fail open.
+ fn reset(&mut self) {
+ let _ = self.sender.unbounded_send(TunnelCommand::IsOffline(false));
+ }
}