Skip to content

Commit

Permalink
Introduced check_for_client_timeout_interval config parameter
Browse files Browse the repository at this point in the history
Signed-off-by: Janos SUTO <sj@acts.hu>
  • Loading branch information
jsuto committed Nov 27, 2019
1 parent f9162bc commit 34e25f6
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 3 deletions.
3 changes: 3 additions & 0 deletions etc/example.conf
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,9 @@ listen_port=25

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=60

Expand Down
1 change: 1 addition & 0 deletions src/cfg.c
Original file line number Diff line number Diff line change
Expand Up @@ -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_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)},
{ "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},
{ "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)},
Expand Down
1 change: 1 addition & 0 deletions src/cfg.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ struct config {
int verbosity;
char locale[MAXVAL];

int check_for_client_timeout_interval;
int smtp_timeout;
int helper_timeout;
int extract_attachments;
Expand Down
5 changes: 2 additions & 3 deletions src/piler-smtp.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ extern char *optarg;
extern int optind;

struct epoll_event event, *events=NULL;
int timeout = 20; // checking for timeout this often [sec]
int num_connections = 0;
int listenerfd = -1;

Expand Down Expand Up @@ -98,7 +97,7 @@ void check_for_client_timeout(){
}
}

alarm(timeout);
alarm(cfg.check_for_client_timeout_interval);
}


Expand Down Expand Up @@ -216,7 +215,7 @@ int main(int argc, char **argv){
if(daemonise == 1 && daemon(1, 0) == -1) fatal(ERR_DAEMON);
#endif

alarm(timeout);
alarm(cfg.check_for_client_timeout_interval);

for(;;){
n = epoll_wait(efd, events, cfg.max_connections, -1);
Expand Down

0 comments on commit 34e25f6

Please sign in to comment.