diff --git a/src/context.rs b/src/context.rs index 11b344f72..1a296627c 100644 --- a/src/context.rs +++ b/src/context.rs @@ -106,7 +106,7 @@ impl Default for BobStatus { #[derive(Default, Debug)] pub struct SmtpState { pub idle: bool, - pub suspended: i32, + pub suspended: bool, pub doing_jobs: i32, pub perform_jobs_needed: i32, pub probe_network: bool, diff --git a/src/dc_job.rs b/src/dc_job.rs index 20f6edda0..f1f9bfa8b 100644 --- a/src/dc_job.rs +++ b/src/dc_job.rs @@ -136,7 +136,7 @@ unsafe fn dc_job_perform(context: &Context, thread: libc::c_int, probe_network: dc_job_kill_action(context, job.action); dc_jobthread_suspend(context, &context.sentbox_thread.clone().read().unwrap(), 1); dc_jobthread_suspend(context, &context.mvbox_thread.clone().read().unwrap(), 1); - dc_suspend_smtp_thread(context, 1); + dc_suspend_smtp_thread(context, true); } let mut tries = 0; @@ -174,7 +174,7 @@ unsafe fn dc_job_perform(context: &Context, thread: libc::c_int, probe_network: &mut context.mvbox_thread.clone().read().unwrap(), 0, ); - dc_suspend_smtp_thread(context, 0); + dc_suspend_smtp_thread(context, false); break; } else if job.try_again == 2 { // just try over next loop unconditionally, the ui typically interrupts idle when the file (video) is ready @@ -279,9 +279,9 @@ fn dc_job_update(context: &Context, job: &dc_job_t) -> bool { .is_ok() } -unsafe fn dc_suspend_smtp_thread(context: &Context, suspend: libc::c_int) { +unsafe fn dc_suspend_smtp_thread(context: &Context, suspend: bool) { context.smtp_state.0.lock().unwrap().suspended = suspend; - if 0 != suspend { + if suspend { loop { if context.smtp_state.0.lock().unwrap().doing_jobs == 0 { return; @@ -1045,7 +1045,7 @@ pub unsafe fn dc_perform_smtp_jobs(context: &Context) { state.probe_network = false; state.perform_jobs_needed = 0; - if 0 != state.suspended { + if state.suspended { info!(context, 0, "SMTP-jobs suspended.",); return; }