mirror of
https://github.com/chatmail/core.git
synced 2026-04-27 10:26:29 +03:00
add dc_accounts_maybe_network_lost() (#2550)
This commit is contained in:
@@ -44,6 +44,13 @@ impl Context {
|
||||
connectivity::idle_interrupted(lock).await;
|
||||
}
|
||||
|
||||
/// Indicate that the network likely is lost.
|
||||
pub async fn maybe_network_lost(&self) {
|
||||
let lock = self.scheduler.read().await;
|
||||
lock.maybe_network_lost().await;
|
||||
connectivity::idle_interrupted(lock).await;
|
||||
}
|
||||
|
||||
pub(crate) async fn interrupt_inbox(&self, info: InterruptInfo) {
|
||||
self.scheduler.read().await.interrupt_inbox(info).await;
|
||||
}
|
||||
@@ -425,6 +432,18 @@ impl Scheduler {
|
||||
.await;
|
||||
}
|
||||
|
||||
async fn maybe_network_lost(&self) {
|
||||
if !self.is_running() {
|
||||
return;
|
||||
}
|
||||
|
||||
self.interrupt_inbox(InterruptInfo::new(false, None))
|
||||
.join(self.interrupt_mvbox(InterruptInfo::new(false, None)))
|
||||
.join(self.interrupt_sentbox(InterruptInfo::new(false, None)))
|
||||
.join(self.interrupt_smtp(InterruptInfo::new(false, None)))
|
||||
.await;
|
||||
}
|
||||
|
||||
async fn interrupt_inbox(&self, info: InterruptInfo) {
|
||||
if let Scheduler::Running { ref inbox, .. } = self {
|
||||
inbox.interrupt(info).await;
|
||||
|
||||
Reference in New Issue
Block a user