diff --git a/src/session.c b/src/session.c index 5329c381..069024ff 100644 --- a/src/session.c +++ b/src/session.c @@ -2,6 +2,7 @@ #include #include #include +#include #include @@ -207,7 +208,9 @@ void handle_data(struct smtp_session *session, char *readbuf, int readlen, struc // pass the puffer to process_data() only if there was an '\n' // on the line or the puffer does not start with a period if(session->protocol_state == SMTP_STATE_DATA && (rc == OK || puf[0] != '.')){ + sig_block(SIGALRM); process_data(session, puf, puflen); + sig_unblock(SIGALRM); } else if(session->protocol_state == SMTP_STATE_BDAT){ process_bdat(session, puf, puflen, cfg); diff --git a/src/smtp.c b/src/smtp.c index 8c693aba..4ce18239 100644 --- a/src/smtp.c +++ b/src/smtp.c @@ -8,7 +8,6 @@ #include #include #include -#include #include #include #include @@ -283,18 +282,14 @@ void process_command_period(struct smtp_session *session){ // TODO: add some error handling - sig_block(SIGALRM); gettimeofday(&tv1, &tz); fsync(session->fd); close(session->fd); gettimeofday(&tv2, &tz); - sig_unblock(SIGALRM); - - syslog(LOG_PRIORITY, "fsync()+close() took %ld [us]", tvdiff(tv2, tv1)); session->fd = -1; - syslog(LOG_PRIORITY, "received: %s, from=%s, size=%d, client=%s, fd=%d", session->ttmpfile, session->mailfrom, session->tot_len, session->remote_host, session->net.socket); + syslog(LOG_PRIORITY, "received: %s, from=%s, size=%d, client=%s, fd=%d, fsync=%ld", session->ttmpfile, session->mailfrom, session->tot_len, session->remote_host, session->net.socket, tvdiff(tv2, tv1)); move_email(session);