Sorry, my last message wasn't a very useful... ap_lingering_close() should be conditionally called based on a feature macro. Something like: HAVE_REUSE_ACCEPT_SOCKET. If the OS supports reusing the accept socket, conditionally issue ap_lingering_close() if the socket has not been disconnected.
I'll fix this when we get the filter architecture straigtened out. BTW, I have started writing a network_out_filter (spilitting function out of core_output_filter). Have limited time to work on it but should have something ready to post early next week. Bill ----- Original Message ----- From: "Bill Stoddard" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Saturday, November 10, 2001 3:37 PM Subject: Re: cvs commit: httpd-2.0/server/mpm/worker worker.c > Ryan, > I understand the motivation for this, but it breaks Windows. In some cases we do not want > to close the socket on Windows; it can be reused for a big performance boost. > > Bill > > ----- Original Message ----- > From: <[EMAIL PROTECTED]> > To: <[EMAIL PROTECTED]> > Sent: Saturday, November 10, 2001 1:26 PM > Subject: cvs commit: httpd-2.0/server/mpm/worker worker.c > > > > rbb 01/11/10 10:26:30 > > > > Modified: include http_connection.h > > server connection.c > > server/mpm/beos beos.c > > server/mpm/mpmt_os2 mpmt_os2_child.c > > server/mpm/netware mpm_netware.c > > server/mpm/perchild perchild.c > > server/mpm/prefork prefork.c > > server/mpm/spmt_os2 spmt_os2.c > > server/mpm/threaded threaded.c > > server/mpm/winnt mpm_winnt.c > > server/mpm/worker worker.c > > Log: > > Remove ap_lingering_close from all of the MPMs. This is now done as > > a cleanup registered with the connection_pool. I have also turned > > ap_lingering_close into a static function, because it is only used > > in connection.c. This is the next step to consolidating all of the > > socket function calls. ap_lingering_close will only be added if the > > core is dealing with a standard socket. > > > > Revision Changes Path > > 1.38 +0 -16 httpd-2.0/include/http_connection.h > > > > Index: http_connection.h > > =================================================================== > > RCS file: /home/cvs/httpd-2.0/include/http_connection.h,v > > retrieving revision 1.37 > > retrieving revision 1.38 > > diff -u -r1.37 -r1.38 > > --- http_connection.h 2001/07/27 21:01:16 1.37 > > +++ http_connection.h 2001/11/10 18:26:29 1.38 > > @@ -88,22 +88,6 @@ > > > > AP_CORE_DECLARE(void) ap_flush_conn(conn_rec *c); > > > > -/** > > - * This function is responsible for the following cases: > > - * <pre> > > - * we now proceed to read from the client until we get EOF, or until > > - * MAX_SECS_TO_LINGER has passed. the reasons for doing this are > > - * documented in a draft: > > - * > > - * http://www.ics.uci.edu/pub/ietf/http/draft-ietf-http-connection-00.txt > > - * > > - * in a nutshell -- if we don't make this effort we risk causing > > - * TCP RST packets to be sent which can tear down a connection before > > - * all the response data has been sent to the client. > > - * </pre> > > - * @param c The connection we are closing > > - */ > > -void ap_lingering_close(conn_rec *); > > #endif > > > > /* Hooks */ > > > > > > > > 1.85 +7 -3 httpd-2.0/server/connection.c > > > > Index: connection.c > > =================================================================== > > RCS file: /home/cvs/httpd-2.0/server/connection.c,v > > retrieving revision 1.84 > > retrieving revision 1.85 > > diff -u -r1.84 -r1.85 > > --- connection.c 2001/07/31 00:34:27 1.84 > > +++ connection.c 2001/11/10 18:26:29 1.85 > > @@ -149,13 +149,14 @@ > > * all the response data has been sent to the client. > > */ > > #define SECONDS_TO_LINGER 2 > > -void ap_lingering_close(conn_rec *c) > > +static apr_status_t ap_lingering_close(void *dummy) > > { > > char dummybuf[512]; > > apr_size_t nbytes = sizeof(dummybuf); > > apr_status_t rc; > > apr_int32_t timeout; > > apr_int32_t total_linger_time = 0; > > + conn_rec *c = dummy; > > > > ap_update_child_status(AP_CHILD_THREAD_FROM_ID(c->id), SERVER_CLOSING, >NULL); > > > > @@ -175,7 +176,7 @@ > > > > if (c->aborted) { > > apr_socket_close(c->client_socket); > > - return; > > + return APR_SUCCESS; > > } > > > > /* Shut down the socket for write, which will send a FIN > > @@ -185,7 +186,7 @@ > > if (apr_shutdown(c->client_socket, APR_SHUTDOWN_WRITE) != APR_SUCCESS || > > c->aborted) { > > apr_socket_close(c->client_socket); > > - return; > > + return APR_SUCCESS; > > } > > > > /* Read all data from the peer until we reach "end-of-file" (FIN > > @@ -208,6 +209,7 @@ > > } > > > > apr_socket_close(c->client_socket); > > + return APR_SUCCESS; > > } > > > > AP_CORE_DECLARE(void) ap_process_connection(conn_rec *c) > > @@ -261,6 +263,8 @@ > > conn->client_socket = inout; > > > > conn->id = id; > > + > > + apr_pool_cleanup_register(p, conn, ap_lingering_close, >apr_pool_cleanup_null); > > > > return conn; > > } > > > > > > > > 1.66 +0 -1 httpd-2.0/server/mpm/beos/beos.c > > > > Index: beos.c > > =================================================================== > > RCS file: /home/cvs/httpd-2.0/server/mpm/beos/beos.c,v > > retrieving revision 1.65 > > retrieving revision 1.66 > > diff -u -r1.65 -r1.66 > > --- beos.c 2001/11/08 22:49:12 1.65 > > +++ beos.c 2001/11/10 18:26:29 1.66 > > @@ -316,7 +316,6 @@ > > > > if (current_conn) { > > ap_process_connection(current_conn); > > - ap_lingering_close(current_conn); > > } > > } > > > > > > > > > > 1.3 +0 -1 httpd-2.0/server/mpm/mpmt_os2/mpmt_os2_child.c > > > > Index: mpmt_os2_child.c > > =================================================================== > > RCS file: /home/cvs/httpd-2.0/server/mpm/mpmt_os2/mpmt_os2_child.c,v > > retrieving revision 1.2 > > retrieving revision 1.3 > > diff -u -r1.2 -r1.3 > > --- mpmt_os2_child.c 2001/08/20 16:10:57 1.2 > > +++ mpmt_os2_child.c 2001/11/10 18:26:29 1.3 > > @@ -411,7 +411,6 @@ > > > > if (current_conn) { > > ap_process_connection(current_conn); > > - ap_lingering_close(current_conn); > > } > > > > apr_pool_destroy(pconn); > > > > > > > > 1.7 +0 -1 httpd-2.0/server/mpm/netware/mpm_netware.c > > > > Index: mpm_netware.c > > =================================================================== > > RCS file: /home/cvs/httpd-2.0/server/mpm/netware/mpm_netware.c,v > > retrieving revision 1.6 > > retrieving revision 1.7 > > diff -u -r1.6 -r1.7 > > --- mpm_netware.c 2001/11/07 05:29:58 1.6 > > +++ mpm_netware.c 2001/11/10 18:26:29 1.7 > > @@ -509,7 +509,6 @@ > > current_conn = ap_new_connection(ptrans, ap_server_conf, csd, my_worker_num); > > if (current_conn) { > > ap_process_connection(current_conn); > > - ap_lingering_close(current_conn); > > } > > > > } > > > > > > > > 1.82 +0 -1 httpd-2.0/server/mpm/perchild/perchild.c > > > > Index: perchild.c > > =================================================================== > > RCS file: /home/cvs/httpd-2.0/server/mpm/perchild/perchild.c,v > > retrieving revision 1.81 > > retrieving revision 1.82 > > diff -u -r1.81 -r1.82 > > --- perchild.c 2001/11/07 05:29:58 1.81 > > +++ perchild.c 2001/11/10 18:26:29 1.82 > > @@ -505,7 +505,6 @@ > > current_conn = ap_new_connection(p, ap_server_conf, sock, conn_id); > > if (current_conn) { > > ap_process_connection(current_conn); > > - ap_lingering_close(current_conn); > > } > > } > > > > > > > > > > 1.209 +0 -1 httpd-2.0/server/mpm/prefork/prefork.c > > > > Index: prefork.c > > =================================================================== > > RCS file: /home/cvs/httpd-2.0/server/mpm/prefork/prefork.c,v > > retrieving revision 1.208 > > retrieving revision 1.209 > > diff -u -r1.208 -r1.209 > > --- prefork.c 2001/11/10 08:00:41 1.208 > > +++ prefork.c 2001/11/10 18:26:29 1.209 > > @@ -792,7 +792,6 @@ > > my_child_num); > > if (current_conn) { > > ap_process_connection(current_conn); > > - ap_lingering_close(current_conn); > > } > > > > /* Check the pod after processing a connection so that we'll go away > > > > > > > > 1.105 +0 -1 httpd-2.0/server/mpm/spmt_os2/spmt_os2.c > > > > Index: spmt_os2.c > > =================================================================== > > RCS file: /home/cvs/httpd-2.0/server/mpm/spmt_os2/spmt_os2.c,v > > retrieving revision 1.104 > > retrieving revision 1.105 > > diff -u -r1.104 -r1.105 > > --- spmt_os2.c 2001/11/07 05:29:58 1.104 > > +++ spmt_os2.c 2001/11/10 18:26:29 1.105 > > @@ -685,7 +685,6 @@ > > > > if (current_conn) { > > ap_process_connection(current_conn); > > - ap_lingering_close(current_conn); > > } > > } > > > > > > > > > > 1.68 +0 -1 httpd-2.0/server/mpm/threaded/threaded.c > > > > Index: threaded.c > > =================================================================== > > RCS file: /home/cvs/httpd-2.0/server/mpm/threaded/threaded.c,v > > retrieving revision 1.67 > > retrieving revision 1.68 > > diff -u -r1.67 -r1.68 > > --- threaded.c 2001/11/07 05:29:58 1.67 > > +++ threaded.c 2001/11/10 18:26:29 1.68 > > @@ -478,7 +478,6 @@ > > current_conn = ap_new_connection(p, ap_server_conf, sock, conn_id); > > if (current_conn) { > > ap_process_connection(current_conn); > > - ap_lingering_close(current_conn); > > } > > } > > > > > > > > > > 1.188 +0 -1 httpd-2.0/server/mpm/winnt/mpm_winnt.c > > > > Index: mpm_winnt.c > > =================================================================== > > RCS file: /home/cvs/httpd-2.0/server/mpm/winnt/mpm_winnt.c,v > > retrieving revision 1.187 > > retrieving revision 1.188 > > diff -u -r1.187 -r1.188 > > --- mpm_winnt.c 2001/11/07 05:29:58 1.187 > > +++ mpm_winnt.c 2001/11/10 18:26:29 1.188 > > @@ -901,7 +901,6 @@ > > apr_getsocketopt(context->sock, APR_SO_DISCONNECTED, &disconnected); > > if (!disconnected) { > > context->accept_socket = INVALID_SOCKET; > > - ap_lingering_close(c); > > } > > } > > else { > > > > > > > > 1.33 +0 -1 httpd-2.0/server/mpm/worker/worker.c > > > > Index: worker.c > > =================================================================== > > RCS file: /home/cvs/httpd-2.0/server/mpm/worker/worker.c,v > > retrieving revision 1.32 > > retrieving revision 1.33 > > diff -u -r1.32 -r1.33 > > --- worker.c 2001/11/07 05:29:58 1.32 > > +++ worker.c 2001/11/10 18:26:30 1.33 > > @@ -502,7 +502,6 @@ > > current_conn = ap_new_connection(p, ap_server_conf, sock, conn_id); > > if (current_conn) { > > ap_process_connection(current_conn); > > - ap_lingering_close(current_conn); > > } > > } > > > > > > > > > > >