diff options
| author | David Lönnhager <david.l@mullvad.net> | 2021-06-28 13:30:12 +0200 |
|---|---|---|
| committer | David Lönnhager <david.l@mullvad.net> | 2021-06-29 17:26:02 +0200 |
| commit | e989349adba2e5b720dc0d6020378ea7ae97548b (patch) | |
| tree | cd13da63f70b21a08270d2522b78f090f8ae2a34 /talpid-core | |
| parent | 686aa1561ccca85d00f2cd29067c83bbca28671b (diff) | |
| download | mullvadvpn-e989349adba2e5b720dc0d6020378ea7ae97548b.tar.xz mullvadvpn-e989349adba2e5b720dc0d6020378ea7ae97548b.zip | |
Remove block_on call in the route manager on Windows
Diffstat (limited to 'talpid-core')
| -rw-r--r-- | talpid-core/src/routing/windows.rs | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/talpid-core/src/routing/windows.rs b/talpid-core/src/routing/windows.rs index 93574884f6..cba05cb936 100644 --- a/talpid-core/src/routing/windows.rs +++ b/talpid-core/src/routing/windows.rs @@ -78,7 +78,7 @@ impl RouteManager { manage_tx: Some(manage_tx), }; runtime.spawn(RouteManager::listen(manage_rx)); - manager.add_routes(required_routes)?; + manager.add_routes(required_routes).await?; Ok(manager) } @@ -171,7 +171,7 @@ impl RouteManager { } /// Applies the given routes until [`RouteManager::stop`] is called. - pub fn add_routes(&self, routes: HashSet<RequiredRoute>) -> Result<()> { + pub async fn add_routes(&self, routes: HashSet<RequiredRoute>) -> Result<()> { if let Some(tx) = &self.manage_tx { let (result_tx, result_rx) = oneshot::channel(); if tx @@ -180,9 +180,7 @@ impl RouteManager { { return Err(Error::RouteManagerDown); } - self.runtime - .block_on(result_rx) - .map_err(|_| Error::ManagerChannelDown)? + result_rx.await.map_err(|_| Error::ManagerChannelDown)? } else { Err(Error::RouteManagerDown) } |
