diff --git a/src/context.rs b/src/context.rs index 963e1e98e..54d8dc06b 100644 --- a/src/context.rs +++ b/src/context.rs @@ -498,8 +498,6 @@ pub struct BobStatus { #[derive(Default, Debug)] pub struct SmtpState { pub idle: bool, - pub suspended: bool, - pub doing_jobs: bool, pub perform_jobs_needed: i32, pub probe_network: bool, } diff --git a/src/job.rs b/src/job.rs index 5ddd5cd54..8b7656c60 100644 --- a/src/job.rs +++ b/src/job.rs @@ -479,24 +479,12 @@ pub fn perform_smtp_jobs(context: &Context) { state.probe_network = false; state.perform_jobs_needed = 0; - if state.suspended { - info!(context, "SMTP-jobs suspended.",); - return; - } - state.doing_jobs = true; probe_smtp_network }; info!(context, "SMTP-jobs started...",); job_perform(context, Thread::Smtp, probe_smtp_network); info!(context, "SMTP-jobs ended."); - - { - let &(ref lock, _) = &*context.smtp_state.clone(); - let mut state = lock.lock().unwrap(); - - state.doing_jobs = false; - } } pub fn perform_smtp_idle(context: &Context) { @@ -775,24 +763,9 @@ fn job_perform(context: &Context, thread: Thread, probe_network: bool) { ); // some configuration jobs are "exclusive": - // - they are always executed in the imap-thread and the smtp-thread is suspended during execution - // - they may change the database handle change the database handle; we do not keep old pointers therefore // - they can be re-executed one time AT_ONCE, but they are not save in the database for later execution if Action::ConfigureImap == job.action || Action::ImexImap == job.action { job_kill_action(context, job.action); - context - .sentbox_thread - .clone() - .read() - .unwrap() - .suspend(context); - context - .mvbox_thread - .clone() - .read() - .unwrap() - .suspend(context); - suspend_smtp_thread(context, true); } let mut tries = 0; @@ -834,19 +807,6 @@ fn job_perform(context: &Context, thread: Thread, probe_network: bool) { tries += 1 } if Action::ConfigureImap == job.action || Action::ImexImap == job.action { - context - .sentbox_thread - .clone() - .read() - .unwrap() - .unsuspend(context); - context - .mvbox_thread - .clone() - .read() - .unwrap() - .unsuspend(context); - suspend_smtp_thread(context, false); break; } else if job.try_again == TryAgain::AtOnce || job.try_again == TryAgain::StandardDelay { let tries = job.tries + 1; @@ -914,18 +874,6 @@ fn get_backoff_time_offset(c_tries: libc::c_int) -> i64 { seconds as i64 } -fn suspend_smtp_thread(context: &Context, suspend: bool) { - context.smtp_state.0.lock().unwrap().suspended = suspend; - if suspend { - loop { - if !context.smtp_state.0.lock().unwrap().doing_jobs { - return; - } - std::thread::sleep(std::time::Duration::from_micros(300 * 1000)); - } - } -} - fn send_mdn(context: &Context, msg_id: MsgId) -> Result<(), Error> { let mut mimefactory = MimeFactory::load_mdn(context, msg_id)?; unsafe { mimefactory.render()? }; diff --git a/src/job_thread.rs b/src/job_thread.rs index c5f5aabb5..c74bdd304 100644 --- a/src/job_thread.rs +++ b/src/job_thread.rs @@ -16,7 +16,6 @@ pub struct JobThread { pub struct JobState { idle: bool, jobs_needed: bool, - suspended: bool, using_handle: bool, } @@ -30,32 +29,6 @@ impl JobThread { } } - pub fn suspend(&self, context: &Context) { - info!(context, "Suspending {}-thread.", self.name,); - { - self.state.0.lock().unwrap().suspended = true; - } - self.interrupt_idle(context); - loop { - let using_handle = self.state.0.lock().unwrap().using_handle; - if !using_handle { - return; - } - std::thread::sleep(std::time::Duration::from_micros(300 * 1000)); - } - } - - pub fn unsuspend(&self, context: &Context) { - info!(context, "Unsuspending {}-thread.", self.name); - - let &(ref lock, ref cvar) = &*self.state.clone(); - let mut state = lock.lock().unwrap(); - - state.suspended = false; - state.idle = true; - cvar.notify_one(); - } - pub fn interrupt_idle(&self, context: &Context) { { self.state.0.lock().unwrap().jobs_needed = true; @@ -77,10 +50,6 @@ impl JobThread { let &(ref lock, _) = &*self.state.clone(); let mut state = lock.lock().unwrap(); - if state.suspended { - return; - } - state.using_handle = true; } @@ -145,14 +114,6 @@ impl JobThread { return; } - if state.suspended { - while !state.idle { - state = cvar.wait(state).unwrap(); - } - state.idle = false; - return; - } - state.using_handle = true; if !use_network {