hold smtp lock during the full send action

This commit is contained in:
holger krekel
2019-08-14 01:11:38 +02:00
parent 4f1551b91f
commit 8009f220fc

View File

@@ -351,18 +351,15 @@ unsafe fn dc_job_do_DC_JOB_SEND(context: &Context, job: &mut dc_job_t) {
if ok_to_continue1 { if ok_to_continue1 {
/* send message */ /* send message */
let body = std::slice::from_raw_parts(buf as *const u8, buf_bytes).to_vec(); let body = std::slice::from_raw_parts(buf as *const u8, buf_bytes).to_vec();
if 0 == context
.smtp // hold the smtp lock during sending of a job and
.lock() // its ok/error response processing. Note that if a message
.unwrap() // was sent we need to mark it in the database as we
.send(context, recipients_list, body) // otherwise might send it twice.
{ let mut sock = context.smtp.lock().unwrap();
context.smtp.lock().unwrap().disconnect(); if 0 == sock.send(context, recipients_list, body) {
dc_job_try_again_later( sock.disconnect();
job, dc_job_try_again_later(job, -1i32, sock.error);
-1i32,
(*&mut context.smtp.clone().lock().unwrap()).error,
);
} else { } else {
dc_delete_file(context, filename_s); dc_delete_file(context, filename_s);
if 0 != job.foreign_id { if 0 != job.foreign_id {