fielding 97/02/11 07:55:22
Modified: src CHANGES http_main.c Log: Reduced timeout on lingering close, removed possibility of a blocked read causing the child to hang, and stopped logging of errors if the socket is not connected (reset by client). This might be only a stopgap measure until we can rethink the accept logic. Reviewed by: Jim Jagielski, Marc Slemko Revision Changes Path 1.158 +4 -0 apache/src/CHANGES Index: CHANGES =================================================================== RCS file: /export/home/cvs/apache/src/CHANGES,v retrieving revision 1.157 retrieving revision 1.158 diff -C3 -r1.157 -r1.158 *** CHANGES 1997/02/10 15:49:53 1.157 --- CHANGES 1997/02/11 15:55:19 1.158 *************** *** 1,5 **** --- 1,9 ---- Changes with Apache 1.2b7 + *) Reduced timeout on lingering close, removed possibility of a blocked + read causing the child to hang, and stopped logging of errors if + the socket is not connected (reset by client). [Roy Fielding] + *) Extensive performance improvements. Cleaned up inefficient use of auto initializers, multiple is_matchexp calls on a static string, and excessive merging of response_code_strings. [Dean Gaudet] 1.119 +16 -9 apache/src/http_main.c Index: http_main.c =================================================================== RCS file: /export/home/cvs/apache/src/http_main.c,v retrieving revision 1.118 retrieving revision 1.119 diff -C3 -r1.118 -r1.119 *** http_main.c 1997/02/10 21:22:20 1.118 --- http_main.c 1997/02/11 15:55:20 1.119 *************** *** 322,332 **** kill_timeout(r); /* Remove any leftover timeouts */ ! /* Close our half of the connection --- send client a FIN */ ! if ((shutdown(sd, 1)) != 0) { /* if it fails, no need to go through the rest of the routine */ ! log_unixerr("shutdown", NULL, "lingering_close", r->server); close(sd); return; } --- 322,335 ---- kill_timeout(r); /* Remove any leftover timeouts */ ! /* Close our half of the connection --- send client a FIN and ! * set the socket to non-blocking for later reads. ! */ ! if (((shutdown(sd, 1)) != 0) || (fcntl(sd, F_SETFL, FNDELAY) == -1)) { /* if it fails, no need to go through the rest of the routine */ ! if (errno != ENOTCONN) ! log_unixerr("shutdown", NULL, "lingering_close", r->server); close(sd); return; } *************** *** 348,359 **** hard_timeout("lingering_close", r); do { ! /* If keep_alive_timeout is too low, using it as a timeout ! * can cause undesirable behavior so pick some pseudo-arbitrary ! * minimum value, currently 10 seconds. These parameters are ! * reset on each pass, since they may be changed by select. ! */ ! tv.tv_sec = max(r->server->keep_alive_timeout, 10); tv.tv_usec = 0; read_rv = 0; fds_read = fds; --- 351,366 ---- hard_timeout("lingering_close", r); do { ! /* We use a 1 second timeout because current (Feb 97) browsers ! * fail to close a connection after the server closes it. Thus, ! * to avoid keeping the child busy, we are only lingering long enough ! * for a client that is actively sending data on a connection. ! * This should be sufficient unless the connection is massively ! * losing packets, in which case we might have missed the RST anyway. ! * These parameters are reset on each pass, since they might be ! * changed by select. ! */ ! tv.tv_sec = 1; tv.tv_usec = 0; read_rv = 0; fds_read = fds;