mirror of
https://bitbucket.org/jsuto/piler.git
synced 2024-12-24 19:10:13 +01:00
piler-smtp wont scare users with epoll error if the remote end just disconnected
Signed-off-by: Janos SUTO <sj@acts.hu>
This commit is contained in:
parent
677abfe295
commit
c96693f98f
@ -11,7 +11,7 @@
|
|||||||
|
|
||||||
#define VERSION "1.3.2"
|
#define VERSION "1.3.2"
|
||||||
|
|
||||||
#define BUILD 981
|
#define BUILD 982
|
||||||
|
|
||||||
#define HOSTID "mailarchiver"
|
#define HOSTID "mailarchiver"
|
||||||
|
|
||||||
@ -62,6 +62,7 @@
|
|||||||
|
|
||||||
#define _LOG_INFO 3
|
#define _LOG_INFO 3
|
||||||
#define _LOG_DEBUG 5
|
#define _LOG_DEBUG 5
|
||||||
|
#define _LOG_EXTREME 100
|
||||||
|
|
||||||
#define MAX_RCPT_TO 128
|
#define MAX_RCPT_TO 128
|
||||||
|
|
||||||
|
@ -206,8 +206,11 @@ int main(int argc, char **argv){
|
|||||||
n = epoll_wait(efd, events, cfg.max_connections, -1);
|
n = epoll_wait(efd, events, cfg.max_connections, -1);
|
||||||
for(i=0; i<n; i++){
|
for(i=0; i<n; i++){
|
||||||
|
|
||||||
|
// The remote side has disconnected without sending QUIT
|
||||||
|
// We log the event only in case of a very high verbosity level
|
||||||
|
// so it won't scare users
|
||||||
if((events[i].events & EPOLLERR) || (events[i].events & EPOLLHUP) || (!(events[i].events & EPOLLIN))){
|
if((events[i].events & EPOLLERR) || (events[i].events & EPOLLHUP) || (!(events[i].events & EPOLLIN))){
|
||||||
syslog(LOG_PRIORITY, "ERROR: epoll error");
|
if(cfg.verbosity >= _LOG_EXTREME) syslog(LOG_PRIORITY, "ERROR: the remote end hung up without sending QUIT");
|
||||||
close(events[i].data.fd);
|
close(events[i].data.fd);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -275,7 +278,7 @@ int main(int argc, char **argv){
|
|||||||
else
|
else
|
||||||
readlen = read(events[i].data.fd, (char*)&readbuf[0], sizeof(readbuf)-1);
|
readlen = read(events[i].data.fd, (char*)&readbuf[0], sizeof(readbuf)-1);
|
||||||
|
|
||||||
if(cfg.verbosity >= _LOG_DEBUG && readlen > 0) syslog(LOG_PRIORITY, "got %ld bytes to read", readlen);
|
if(cfg.verbosity >= _LOG_EXTREME && readlen > 0) syslog(LOG_PRIORITY, "got %ld bytes to read", readlen);
|
||||||
|
|
||||||
if(readlen == -1){
|
if(readlen == -1){
|
||||||
/* If errno == EAGAIN, that means we have read all data. So go back to the main loop. */
|
/* If errno == EAGAIN, that means we have read all data. So go back to the main loop. */
|
||||||
|
Loading…
Reference in New Issue
Block a user