diff --git a/src/transport.rs b/src/transport.rs index abf50d14a..6343968ab 100644 --- a/src/transport.rs +++ b/src/transport.rs @@ -9,6 +9,7 @@ //! and configured list of connection candidates. use std::fmt; +use std::pin::Pin; use anyhow::{Context as _, Result, bail, format_err}; use deltachat_contact_tools::{EmailAddress, addr_normalize}; @@ -760,11 +761,18 @@ pub(crate) async fn sync_transports( .await?; if modified { + tokio::task::spawn(restart_io_if_running_boxed(context.clone())); context.emit_event(EventType::TransportsModified); } Ok(()) } +/// Same as `context.restart_io_if_running()`, but `Box::pin`ed and with a `+ Send` bound, +/// so that it can be called recursively. +fn restart_io_if_running_boxed(context: Context) -> Pin + Send>> { + Box::pin(async move { context.restart_io_if_running().await }) +} + /// Adds transport entry to the `transports` table with empty configuration. pub(crate) async fn add_pseudo_transport(context: &Context, addr: &str) -> Result<()> { context.sql