mirror of
https://github.com/chatmail/core.git
synced 2026-04-19 06:26:30 +03:00
hold smtp lock during the full send action
This commit is contained in:
@@ -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 {
|
||||||
|
|||||||
Reference in New Issue
Block a user