mirror of
https://github.com/chatmail/core.git
synced 2026-05-12 19:36:32 +03:00
Refine type of SmtpState.suspended to bool
This commit is contained in:
@@ -106,7 +106,7 @@ impl Default for BobStatus {
|
|||||||
#[derive(Default, Debug)]
|
#[derive(Default, Debug)]
|
||||||
pub struct SmtpState {
|
pub struct SmtpState {
|
||||||
pub idle: bool,
|
pub idle: bool,
|
||||||
pub suspended: i32,
|
pub suspended: bool,
|
||||||
pub doing_jobs: i32,
|
pub doing_jobs: i32,
|
||||||
pub perform_jobs_needed: i32,
|
pub perform_jobs_needed: i32,
|
||||||
pub probe_network: bool,
|
pub probe_network: bool,
|
||||||
|
|||||||
@@ -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_job_kill_action(context, job.action);
|
||||||
dc_jobthread_suspend(context, &context.sentbox_thread.clone().read().unwrap(), 1);
|
dc_jobthread_suspend(context, &context.sentbox_thread.clone().read().unwrap(), 1);
|
||||||
dc_jobthread_suspend(context, &context.mvbox_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;
|
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(),
|
&mut context.mvbox_thread.clone().read().unwrap(),
|
||||||
0,
|
0,
|
||||||
);
|
);
|
||||||
dc_suspend_smtp_thread(context, 0);
|
dc_suspend_smtp_thread(context, false);
|
||||||
break;
|
break;
|
||||||
} else if job.try_again == 2 {
|
} else if job.try_again == 2 {
|
||||||
// just try over next loop unconditionally, the ui typically interrupts idle when the file (video) is ready
|
// 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()
|
.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;
|
context.smtp_state.0.lock().unwrap().suspended = suspend;
|
||||||
if 0 != suspend {
|
if suspend {
|
||||||
loop {
|
loop {
|
||||||
if context.smtp_state.0.lock().unwrap().doing_jobs == 0 {
|
if context.smtp_state.0.lock().unwrap().doing_jobs == 0 {
|
||||||
return;
|
return;
|
||||||
@@ -1045,7 +1045,7 @@ pub unsafe fn dc_perform_smtp_jobs(context: &Context) {
|
|||||||
state.probe_network = false;
|
state.probe_network = false;
|
||||||
state.perform_jobs_needed = 0;
|
state.perform_jobs_needed = 0;
|
||||||
|
|
||||||
if 0 != state.suspended {
|
if state.suspended {
|
||||||
info!(context, 0, "SMTP-jobs suspended.",);
|
info!(context, 0, "SMTP-jobs suspended.",);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user