diff options
| -rw-r--r-- | mullvad-daemon/src/lib.rs | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/mullvad-daemon/src/lib.rs b/mullvad-daemon/src/lib.rs index bde37e85fb..a7493f1d82 100644 --- a/mullvad-daemon/src/lib.rs +++ b/mullvad-daemon/src/lib.rs @@ -1151,12 +1151,16 @@ where } async fn schedule_reconnect(&mut self, delay: Duration) { + self.unschedule_reconnect(); + let tunnel_command_tx = self.tx.to_specialized_sender(); let (future, abort_handle) = abortable(Box::pin(async move { tokio::time::sleep(delay).await; log::debug!("Attempting to reconnect"); - let (tx, _) = oneshot::channel(); + let (tx, rx) = oneshot::channel(); let _ = tunnel_command_tx.send(DaemonCommand::Reconnect(tx)); + // suppress "unable to send" warning: + let _ = rx.await; })); tokio::spawn(future); |
