mirror of
https://bitbucket.org/jsuto/piler.git
synced 2024-12-25 06:30:13 +01:00
Revised deferring alarm signal
Signed-off-by: Janos SUTO <sj@acts.hu>
This commit is contained in:
parent
6b087cf5fd
commit
779175b596
@ -2,6 +2,7 @@
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <netdb.h>
|
||||
#include <signal.h>
|
||||
#include <piler.h>
|
||||
|
||||
|
||||
@ -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);
|
||||
|
@ -8,7 +8,6 @@
|
||||
#include <arpa/inet.h>
|
||||
#include <fcntl.h>
|
||||
#include <syslog.h>
|
||||
#include <signal.h>
|
||||
#include <unistd.h>
|
||||
#include <openssl/ssl.h>
|
||||
#include <openssl/err.h>
|
||||
@ -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);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user