diff --git a/ChangeLog b/ChangeLog index 0821147ee..7f95fb1c7 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +Sat Feb 7 19:06:19 EET 2009 (edwin) +------------------------------------ + * clamd/server-th.c: keep MODE_WAITREPLY in select still, so if + garbage is sent we can close. Though when poll says that socket is + closed, we shouldn't try closing again if we're in WAIT_REPLY mode + (since we alraedy closed it from another thread). + Sat Feb 7 19:00:48 EET 2009 (edwin) ------------------------------------ * clamd/server-th.c, clamd/session.c: also remove socket from diff --git a/clamd/server-th.c b/clamd/server-th.c index ef1e4b4f8..bb0a947da 100644 --- a/clamd/server-th.c +++ b/clamd/server-th.c @@ -793,8 +793,14 @@ int recvloop_th(int *socketds, unsigned nsockets, struct cl_engine *engine, unsi } if (buf->got_newdata == -1) { - logg("*RECVTH: client read error or EOF on read\n"); - error = 1; + if (buf->mode == MODE_WAITREPLY) { + logg("*RECVTH: mode WAIT_REPLY -> closed\n"); + buf->fd = -1; + continue; + } else { + logg("*RECVTH: client read error or EOF on read\n"); + error = 1; + } } if (buf->mode == MODE_WAITANCILL) { @@ -862,12 +868,12 @@ int recvloop_th(int *socketds, unsigned nsockets, struct cl_engine *engine, unsi /* if there are no more active jobs */ shutdown(conn.sd, 2); closesocket(conn.sd); + buf->fd = -1; } else { logg("*RECVTH: mode -> MODE_WAITREPLY\n"); /* no more commands are accepted */ conn.mode = MODE_WAITREPLY; } - buf->fd = -1; } pos += cmdlen+1; if (conn.mode == MODE_STREAM) {