Merge pull request #1531 from deltachat/forgiving-start-io

This commit is contained in:
Friedel Ziegelmayer
2020-05-27 17:20:35 +02:00
committed by GitHub
2 changed files with 13 additions and 3 deletions

View File

@@ -138,7 +138,10 @@ impl Context {
/// Starts the IO scheduler.
pub async fn start_io(&self) {
info!(self, "starting IO");
assert!(!self.is_io_running().await, "context is already running");
if self.is_io_running().await {
info!(self, "IO is already running");
return;
}
{
let l = &mut *self.inner.scheduler.write().await;
@@ -154,6 +157,11 @@ impl Context {
/// Stops the IO scheduler.
pub async fn stop_io(&self) {
info!(self, "stopping IO");
if !self.is_io_running().await {
info!(self, "IO is not running");
return;
}
self.inner.stop_io().await;
}