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).

git-svn-id: file:///var/lib/svn/clamav-devel/branches/clamd-proto@4698 77e5149b-7576-45b1-b177-96237e5ba77b
0.95
Török Edvin 17 years ago
parent 07ac8bb23a
commit fd468937fc
  1. 7
      ChangeLog
  2. 12
      clamd/server-th.c

@ -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

@ -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) {

Loading…
Cancel
Save