diff options
| author | David Lönnhager <david.l@mullvad.net> | 2021-06-21 14:35:09 +0200 |
|---|---|---|
| committer | David Lönnhager <david.l@mullvad.net> | 2021-06-21 14:35:09 +0200 |
| commit | 26022a683c2e1f7aa8fdd912e7e991c5c66118d5 (patch) | |
| tree | 399fe1baf1279db2f81bfb99e3357052b3c76222 | |
| parent | 99a5c4a924e869f31eff1598fe24c1e58bbae192 (diff) | |
| parent | 4a0c35d17dcea54800aacaae04b12609a7575f96 (diff) | |
| download | mullvadvpn-26022a683c2e1f7aa8fdd912e7e991c5c66118d5.tar.xz mullvadvpn-26022a683c2e1f7aa8fdd912e7e991c5c66118d5.zip | |
Merge branch 'fix-deadlock'
| -rw-r--r-- | CHANGELOG.md | 1 | ||||
| -rw-r--r-- | mullvad-rpc/src/rest.rs | 20 |
2 files changed, 12 insertions, 9 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md index d310dd6b89..78a28bebac 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -29,6 +29,7 @@ Line wrap the file at 100 chars. Th ### Fixed - Fix link to download page not always using the beta URL when it should. +- Fix deadlock that may occur when the API cannot be reached while entering the connecting state. #### Linux - Make offline monitor aware of routing table changes. diff --git a/mullvad-rpc/src/rest.rs b/mullvad-rpc/src/rest.rs index d21e20fbcd..57abf5bffd 100644 --- a/mullvad-rpc/src/rest.rs +++ b/mullvad-rpc/src/rest.rs @@ -133,6 +133,7 @@ impl RequestService { let (request_future, abort_handle) = abortable(self.client.request(hyper_request).map_err(Error::from)); let address_cache = self.address_cache.clone(); + let handle = self.handle.clone(); let future = async move { let response = @@ -145,19 +146,20 @@ impl RequestService { if let Err(err) = &response { match err { Error::HyperError(_) | Error::TimeoutError(_) => { + log::error!("HTTP request failed: {}", err); let current_address = address_cache.peek_address(); if current_address == host_addr && address_cache.has_tried_current_address() { - address_cache.select_new_address().await; - let new_address = address_cache.peek_address(); - - log::error!( - "HTTP request failed: {}, using address {}. Trying next API address: {}", - err, - current_address, - new_address, - ); + handle.spawn(async move { + address_cache.select_new_address().await; + let new_address = address_cache.peek_address(); + log::error!( + "Request failed using address {}. Trying next API address: {}", + current_address, + new_address, + ); + }); } } _ => (), |
