mirror of
https://github.com/chatmail/core.git
synced 2026-04-02 05:22:14 +03:00
fix: Restart i/o when there are new transports in a sync message (#7640)
This commit is contained in:
@@ -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<Box<dyn Future<Output = ()> + 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
|
||||
|
||||
Reference in New Issue
Block a user