Introduced check_for_client_timeout_interval config parameter

Signed-off-by: Janos SUTO <sj@acts.hu>
This commit is contained in:
Janos SUTO 2019-11-27 20:47:04 +01:00
parent f9162bc085
commit 34e25f6c74
4 changed files with 7 additions and 3 deletions

View File

@ -66,6 +66,9 @@ listen_port=25
clamd_socket=/tmp/clamd clamd_socket=/tmp/clamd
; check for client timeout interval. Default: 30 sec
check_for_client_timeout_interval=30
; smtp timeout. Default: 60 sec ; smtp timeout. Default: 60 sec
smtp_timeout=60 smtp_timeout=60

View File

@ -62,6 +62,7 @@ struct _parse_rule config_parse_rules[] =
{ "archive_emails_not_having_message_id", "integer", (void*) int_parser, offsetof(struct config, archive_emails_not_having_message_id), "0", sizeof(int)}, { "archive_emails_not_having_message_id", "integer", (void*) int_parser, offsetof(struct config, archive_emails_not_having_message_id), "0", sizeof(int)},
{ "archive_only_mydomains", "integer", (void*) int_parser, offsetof(struct config, archive_only_mydomains), "0", sizeof(int)}, { "archive_only_mydomains", "integer", (void*) int_parser, offsetof(struct config, archive_only_mydomains), "0", sizeof(int)},
{ "backlog", "integer", (void*) int_parser, offsetof(struct config, backlog), "20", sizeof(int)}, { "backlog", "integer", (void*) int_parser, offsetof(struct config, backlog), "20", sizeof(int)},
{ "check_for_client_timeout_interval", "integer", (void*) int_parser, offsetof(struct config, check_for_client_timeout_interval), "30", sizeof(int)},
{ "cipher_list", "string", (void*) string_parser, offsetof(struct config, cipher_list), "ECDH+AESGCM:DH+AESGCM:ECDH+AES256:DH+AES256:ECDH+AES128:DH+AES:ECDH+3DES:DH+3DES:RSA+AESGCM:RSA+AES:RSA+3DES:!aNULL:!MD5:!DSS", MAXVAL-1}, { "cipher_list", "string", (void*) string_parser, offsetof(struct config, cipher_list), "ECDH+AESGCM:DH+AESGCM:ECDH+AES256:DH+AES256:ECDH+AES128:DH+AES:ECDH+3DES:DH+3DES:RSA+AESGCM:RSA+AES:RSA+3DES:!aNULL:!MD5:!DSS", MAXVAL-1},
{ "clamd_addr", "string", (void*) string_parser, offsetof(struct config, clamd_addr), "", MAXVAL-1}, { "clamd_addr", "string", (void*) string_parser, offsetof(struct config, clamd_addr), "", MAXVAL-1},
{ "clamd_port", "integer", (void*) int_parser, offsetof(struct config, clamd_port), "0", sizeof(int)}, { "clamd_port", "integer", (void*) int_parser, offsetof(struct config, clamd_port), "0", sizeof(int)},

View File

@ -49,6 +49,7 @@ struct config {
int verbosity; int verbosity;
char locale[MAXVAL]; char locale[MAXVAL];
int check_for_client_timeout_interval;
int smtp_timeout; int smtp_timeout;
int helper_timeout; int helper_timeout;
int extract_attachments; int extract_attachments;

View File

@ -31,7 +31,6 @@ extern char *optarg;
extern int optind; extern int optind;
struct epoll_event event, *events=NULL; struct epoll_event event, *events=NULL;
int timeout = 20; // checking for timeout this often [sec]
int num_connections = 0; int num_connections = 0;
int listenerfd = -1; int listenerfd = -1;
@ -98,7 +97,7 @@ void check_for_client_timeout(){
} }
} }
alarm(timeout); alarm(cfg.check_for_client_timeout_interval);
} }
@ -216,7 +215,7 @@ int main(int argc, char **argv){
if(daemonise == 1 && daemon(1, 0) == -1) fatal(ERR_DAEMON); if(daemonise == 1 && daemon(1, 0) == -1) fatal(ERR_DAEMON);
#endif #endif
alarm(timeout); alarm(cfg.check_for_client_timeout_interval);
for(;;){ for(;;){
n = epoll_wait(efd, events, cfg.max_connections, -1); n = epoll_wait(efd, events, cfg.max_connections, -1);