From 07d7316a9f07872343828ffef397b1f85fea0da1 Mon Sep 17 00:00:00 2001 From: Dmitry Bogatov Date: Thu, 1 Aug 2019 06:31:58 +0000 Subject: [PATCH] Refine type of Context.perform_inbox_jobs_needed to bool --- src/context.rs | 4 ++-- src/dc_job.rs | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/context.rs b/src/context.rs index cf39e5387..3124727f7 100644 --- a/src/context.rs +++ b/src/context.rs @@ -27,7 +27,7 @@ pub struct Context { pub blobdir: Arc>, pub sql: Sql, pub inbox: Arc>, - pub perform_inbox_jobs_needed: Arc>, + pub perform_inbox_jobs_needed: Arc>, pub probe_imap_network: Arc>, pub sentbox_thread: Arc>, pub mvbox_thread: Arc>, @@ -161,7 +161,7 @@ pub fn dc_context_new( ), ))), probe_imap_network: Arc::new(RwLock::new(false)), - perform_inbox_jobs_needed: Arc::new(RwLock::new(0)), + perform_inbox_jobs_needed: Arc::new(RwLock::new(false)), } } diff --git a/src/dc_job.rs b/src/dc_job.rs index e483c2ed5..66eac5d9d 100644 --- a/src/dc_job.rs +++ b/src/dc_job.rs @@ -55,7 +55,7 @@ pub unsafe fn dc_perform_imap_jobs(context: &Context) { let probe_imap_network = *context.probe_imap_network.clone().read().unwrap(); *context.probe_imap_network.write().unwrap() = false; - *context.perform_inbox_jobs_needed.write().unwrap() = 0; + *context.perform_inbox_jobs_needed.write().unwrap() = false; dc_job_perform(context, DC_IMAP_THREAD, probe_imap_network); info!(context, 0, "dc_perform_imap_jobs ended.",); @@ -859,7 +859,7 @@ pub unsafe fn dc_interrupt_smtp_idle(context: &Context) { pub unsafe fn dc_interrupt_imap_idle(context: &Context) { info!(context, 0, "Interrupting IMAP-IDLE...",); - *context.perform_inbox_jobs_needed.write().unwrap() = 1; + *context.perform_inbox_jobs_needed.write().unwrap() = true; context.inbox.read().unwrap().interrupt_idle(); } @@ -967,7 +967,7 @@ pub fn dc_perform_imap_idle(context: &Context) { connect_to_inbox(context, &inbox); - if 0 != *context.perform_inbox_jobs_needed.clone().read().unwrap() { + if *context.perform_inbox_jobs_needed.clone().read().unwrap() { info!( context, 0, "INBOX-IDLE will not be started because of waiting jobs."