summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorLinus Färnstrand <linus@mullvad.net>2017-10-13 19:01:36 +0200
committerLinus Färnstrand <linus@mullvad.net>2017-10-13 19:01:36 +0200
commit69ac056634446b75f870dfd58413c181cc54e1a8 (patch)
tree9044565a820760eab19c96e28cdb9d708074dd0b
parentd2199c89e37cf89789f8f2fd9af0a4a9c72a407a (diff)
parent81b6013ca30b06efa6b087c868aa60f47926396c (diff)
downloadmullvadvpn-69ac056634446b75f870dfd58413c181cc54e1a8.tar.xz
mullvadvpn-69ac056634446b75f870dfd58413c181cc54e1a8.zip
Merge branch 'delay-between-openvpn-spawns'
-rw-r--r--.travis.yml4
-rw-r--r--appveyor.yml4
-rw-r--r--mullvad-daemon/src/main.rs6
3 files changed, 10 insertions, 4 deletions
diff --git a/.travis.yml b/.travis.yml
index af5254cff2..2018417265 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -13,8 +13,8 @@ before_script:
- env
script:
- - cargo build --all --verbose
- - cargo test --all --verbose
+ - cargo build --verbose
+ - cargo test --verbose
# Format only on nightly, since that is where rustfmt-nightly compiles
- if [ "${TRAVIS_RUST_VERSION}" = "nightly" ] && [ "${TRAVIS_OS_NAME}" = "linux" ]; then
export LD_LIBRARY_PATH=$(rustc --print sysroot)/lib:$LD_LIBRARY_PATH
diff --git a/appveyor.yml b/appveyor.yml
index a7668d4c00..7161c2a028 100644
--- a/appveyor.yml
+++ b/appveyor.yml
@@ -43,8 +43,8 @@ install:
# This is the "test phase", tweak it as you see fit
test_script:
- - cargo build --all --target %TARGET%
- - cargo test --all --target %TARGET%
+ - cargo build --target %TARGET%
+ - cargo test --target %TARGET%
# Cache build binaries for faster builds next time
cache:
diff --git a/mullvad-daemon/src/main.rs b/mullvad-daemon/src/main.rs
index 2525a39308..c427c252bb 100644
--- a/mullvad-daemon/src/main.rs
+++ b/mullvad-daemon/src/main.rs
@@ -60,6 +60,7 @@ use std::net::Ipv4Addr;
use std::path::PathBuf;
use std::sync::{mpsc, Arc, Mutex};
use std::thread;
+use std::time::{Duration, Instant};
use talpid_core::firewall::{Firewall, FirewallProxy, SecurityPolicy};
use talpid_core::mpsc::IntoSender;
@@ -104,6 +105,7 @@ lazy_static! {
// se7.mullvad.net
Endpoint::new(Ipv4Addr::new(185, 65, 132, 104), 1300, TransportProtocol::Udp),
];
+ static ref MIN_TUNNEL_ALIVE_TIME_MS: Duration = Duration::from_millis(1000);
}
const CRATE_NAME: &str = "mullvadd";
@@ -544,7 +546,11 @@ impl Daemon {
fn spawn_tunnel_monitor_wait_thread(&self, tunnel_monitor: TunnelMonitor) {
let error_tx = self.tx.clone();
thread::spawn(move || {
+ let start = Instant::now();
let result = tunnel_monitor.wait();
+ if let Some(sleep_dur) = MIN_TUNNEL_ALIVE_TIME_MS.checked_sub(start.elapsed()) {
+ thread::sleep(sleep_dur);
+ }
let _ = error_tx.send(DaemonEvent::TunnelExited(result));
trace!("Tunnel monitor thread exit");
});