[srvx-commits] CVS: services/src sockcheck.c,1.54.2.14,1.54.2.15
Brought to you by:
entrope
From: Miles P. <pet...@us...> - 2001-08-11 20:59:56
|
Update of /cvsroot/srvx/services/src In directory usw-pr-cvs1:/tmp/cvs-serv5373 Modified Files: Tag: rel-1_0 sockcheck.c Log Message: handle checks that require no response properly Index: sockcheck.c =================================================================== RCS file: /cvsroot/srvx/services/src/sockcheck.c,v retrieving revision 1.54.2.14 retrieving revision 1.54.2.15 diff -C2 -r1.54.2.14 -r1.54.2.15 *** sockcheck.c 2001/08/11 20:31:41 1.54.2.14 --- sockcheck.c 2001/08/11 20:59:53 1.54.2.15 *************** *** 639,642 **** --- 639,643 ---- /* read what we can from the fd */ int res; + unsigned int n; res = read(fd, client->read + client->read_used, client->read_size - client->read_used); *************** *** 652,660 **** } /* See if what's been read matches any of the expected responses */ while (client->read_pos < client->read_used) { unsigned char curr, bleh; const unsigned char *resp_state; - unsigned int n; curr = client->read[client->read_pos++]; --- 653,671 ---- } + /* Handle responses that dont require reading */ + if (client->read_pos == client->read_used) { + for (n=0; n<(client->state->responses.used-1); n++) { + /* since we have nothing to read we will never enter the while() loop */ + if (!strlen(client->resp_state[n])) { + log(PC_LOG, LOG_ERROR, "Choosing response %d for client %s\n", n, client->addr->hostname); + return n; + } + } + } + /* See if what's been read matches any of the expected responses */ while (client->read_pos < client->read_used) { unsigned char curr, bleh; const unsigned char *resp_state; curr = client->read[client->read_pos++]; |