From 95051be2b14b31e7257607fa2d706c4063d099ad Mon Sep 17 00:00:00 2001 From: "B. Petersen" Date: Tue, 19 Jun 2018 16:06:44 +0200 Subject: [PATCH] move timeouts to jobs-header --- src/mrimap.c | 3 ++- src/mrjob.h | 7 +++++++ src/mrsmtp.c | 3 ++- 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/mrimap.c b/src/mrimap.c index d4fd5229..d268000c 100644 --- a/src/mrimap.c +++ b/src/mrimap.c @@ -27,6 +27,7 @@ #include /* for sleep() */ #include "mrmailbox_internal.h" #include "mrimap.h" +#include "mrjob.h" #include "mrosnative.h" #include "mrloginparam.h" @@ -1044,7 +1045,7 @@ static int setup_handle_if_needed__(mrimap_t* ths) ths->m_hEtpan = mailimap_new(0, NULL); - mailimap_set_timeout(ths->m_hEtpan, 30); /* 30 seconds until actions are aborted, this is also used in mailcore2 */ + mailimap_set_timeout(ths->m_hEtpan, MR_IMAP_TIMEOUT_SEC); if( ths->m_server_flags&(MR_IMAP_SOCKET_STARTTLS|MR_IMAP_SOCKET_PLAIN) ) { diff --git a/src/mrjob.h b/src/mrjob.h index 937d4537..ba190c3e 100644 --- a/src/mrjob.h +++ b/src/mrjob.h @@ -44,6 +44,13 @@ extern "C" { #define MRJ_SEND_MSG_TO_SMTP 5900 // ... high priority +// timeouts until actions are aborted. +// this may also affects IDLE to return, so a re-connect may take this time. +// mailcore2 uses 30 seconds, k-9 uses 10 seconds +#define MR_IMAP_TIMEOUT_SEC 30 +#define MR_SMTP_TIMEOUT_SEC 30 + + /** * Library-internal. */ diff --git a/src/mrsmtp.c b/src/mrsmtp.c index 6f9c6ce9..18cab2f6 100644 --- a/src/mrsmtp.c +++ b/src/mrsmtp.c @@ -23,6 +23,7 @@ #include #include "mrmailbox_internal.h" #include "mrsmtp.h" +#include "mrjob.h" #ifndef DEBUG_SMTP @@ -123,7 +124,7 @@ int mrsmtp_connect(mrsmtp_t* ths, const mrloginparam_t* lp) mrmailbox_log_error(ths->m_mailbox, 0, "SMTP-object creation failed."); goto cleanup; } - mailsmtp_set_timeout(ths->m_hEtpan, 30); // 30 seconds until actions are aborted, this is also used in mailcore2 + mailsmtp_set_timeout(ths->m_hEtpan, MR_SMTP_TIMEOUT_SEC); mailsmtp_set_progress_callback(ths->m_hEtpan, body_progress, ths); #if DEBUG_SMTP mailsmtp_set_logger(ths->m_hEtpan, logger, ths);