diff options
Diffstat (limited to 'server')
-rw-r--r-- | server/connection.c | 41 | ||||
-rw-r--r-- | server/core.c | 17 | ||||
-rw-r--r-- | server/mpm/beos/beos.c | 1 | ||||
-rw-r--r-- | server/mpm/experimental/perchild/perchild.c | 1 | ||||
-rw-r--r-- | server/mpm/mpmt_os2/mpmt_os2_child.c | 1 | ||||
-rw-r--r-- | server/mpm/netware/mpm_netware.c | 1 | ||||
-rw-r--r-- | server/mpm/perchild/perchild.c | 1 | ||||
-rw-r--r-- | server/mpm/prefork/prefork.c | 1 | ||||
-rw-r--r-- | server/mpm/spmt_os2/spmt_os2.c | 1 | ||||
-rw-r--r-- | server/mpm/threaded/threaded.c | 1 | ||||
-rw-r--r-- | server/mpm/winnt/mpm_winnt.c | 4 | ||||
-rw-r--r-- | server/mpm/worker/worker.c | 1 |
12 files changed, 35 insertions, 36 deletions
diff --git a/server/connection.c b/server/connection.c index b0d59aaed0..1bc6c2bb1b 100644 --- a/server/connection.c +++ b/server/connection.c @@ -68,6 +68,7 @@ #include "ap_mpm.h" #include "mpm_default.h" #include "http_config.h" +#include "http_core.h" #include "http_vhost.h" #include "scoreboard.h" #include "http_log.h" @@ -153,20 +154,24 @@ AP_CORE_DECLARE(void) ap_flush_conn(conn_rec *c) * all the response data has been sent to the client. */ #define SECONDS_TO_LINGER 2 -apr_status_t ap_lingering_close(void *dummy) +AP_DECLARE(void) ap_lingering_close(conn_rec *c) { char dummybuf[512]; apr_size_t nbytes = sizeof(dummybuf); apr_status_t rc; apr_int32_t timeout; apr_int32_t total_linger_time = 0; - core_net_rec *net = dummy; + apr_socket_t *csd = ap_get_module_config(c->conn_config, &core_module); - ap_update_child_status(AP_CHILD_THREAD_FROM_ID(net->c->id), SERVER_CLOSING, NULL); + if (!csd) { + return; + } + + ap_update_child_status(AP_CHILD_THREAD_FROM_ID(c->id), SERVER_CLOSING, NULL); #ifdef NO_LINGCLOSE - ap_flush_conn(net->c); /* just close it */ - apr_socket_close(net->client_socket); + ap_flush_conn(c); /* just close it */ + apr_socket_close(csd); return; #endif @@ -176,20 +181,20 @@ apr_status_t ap_lingering_close(void *dummy) */ /* Send any leftover data to the client, but never try to again */ - ap_flush_conn(net->c); + ap_flush_conn(c); - if (net->c->aborted) { - apr_socket_close(net->client_socket); - return APR_SUCCESS; + if (c->aborted) { + apr_socket_close(csd); + return; } /* Shut down the socket for write, which will send a FIN * to the peer. */ - if (apr_shutdown(net->client_socket, APR_SHUTDOWN_WRITE) != APR_SUCCESS || - net->c->aborted) { - apr_socket_close(net->client_socket); - return APR_SUCCESS; + if (apr_shutdown(csd, APR_SHUTDOWN_WRITE) != APR_SUCCESS || + c->aborted) { + apr_socket_close(csd); + return; } /* Read all data from the peer until we reach "end-of-file" (FIN @@ -198,11 +203,11 @@ apr_status_t ap_lingering_close(void *dummy) * which seems to work well), close the connection. */ timeout = SECONDS_TO_LINGER * APR_USEC_PER_SEC; - apr_setsocketopt(net->client_socket, APR_SO_TIMEOUT, timeout); - apr_setsocketopt(net->client_socket, APR_INCOMPLETE_READ, 1); + apr_setsocketopt(csd, APR_SO_TIMEOUT, timeout); + apr_setsocketopt(csd, APR_INCOMPLETE_READ, 1); for (;;) { nbytes = sizeof(dummybuf); - rc = apr_recv(net->client_socket, dummybuf, &nbytes); + rc = apr_recv(csd, dummybuf, &nbytes); if (rc != APR_SUCCESS || nbytes == 0) break; total_linger_time += SECONDS_TO_LINGER; @@ -211,8 +216,8 @@ apr_status_t ap_lingering_close(void *dummy) } } - apr_socket_close(net->client_socket); - return APR_SUCCESS; + apr_socket_close(csd); + return; } AP_CORE_DECLARE(void) ap_process_connection(conn_rec *c) diff --git a/server/core.c b/server/core.c index bf3eee7995..3a9378f81b 100644 --- a/server/core.c +++ b/server/core.c @@ -3095,10 +3095,6 @@ static apr_status_t core_output_filter(ap_filter_t *f, apr_bucket_brigade *b) (nbytes + flen < AP_MIN_BYTES_TO_WRITE) && !APR_BUCKET_IS_FLUSH(last_e)) || (nbytes + flen < AP_MIN_BYTES_TO_WRITE && APR_BUCKET_IS_EOS(last_e) && c->keepalive)) { - if (ctx->subpool == NULL) { - apr_pool_create(&ctx->subpool, f->c->pool); - } - /* NEVER save an EOS in here. If we are saving a brigade with * an EOS bucket, then we are doing keepalive connections, and * we want to process to second request fully. @@ -3110,7 +3106,7 @@ static apr_status_t core_output_filter(ap_filter_t *f, apr_bucket_brigade *b) * after the request_pool is cleared. */ if (ctx->b == NULL) { - ctx->b = apr_brigade_create(ctx->subpool); + ctx->b = apr_brigade_create(c->pool); } APR_BRIGADE_FOREACH(bucket, b) { @@ -3135,13 +3131,11 @@ static apr_status_t core_output_filter(ap_filter_t *f, apr_bucket_brigade *b) return rv; } apr_brigade_write(ctx->b, NULL, NULL, str, n); - ctx->subpool_has_stuff = 1; } apr_brigade_destroy(b); } else { - ap_save_brigade(f, &ctx->b, &b, ctx->subpool); - ctx->subpool_has_stuff = 1; + ap_save_brigade(f, &ctx->b, &b, c->pool); } return APR_SUCCESS; } @@ -3216,11 +3210,6 @@ static apr_status_t core_output_filter(ap_filter_t *f, apr_bucket_brigade *b) more = NULL; } /* end while () */ - if (ctx->subpool && ctx->subpool_has_stuff) { - apr_pool_clear(ctx->subpool); - ctx->subpool_has_stuff = 0; - } - return APR_SUCCESS; } @@ -3322,8 +3311,6 @@ static conn_rec *core_create_conn(apr_pool_t *ptrans, server_rec *server, net->c->id = conn_id; - apr_pool_cleanup_register(ptrans, net, ap_lingering_close, apr_pool_cleanup_null); - ap_set_module_config(net->c->conn_config, &core_module, csd); ap_add_input_filter("CORE_IN", net, NULL, net->c); ap_add_output_filter("CORE", net, NULL, net->c); diff --git a/server/mpm/beos/beos.c b/server/mpm/beos/beos.c index 4ac0f6b70f..63b1b04c91 100644 --- a/server/mpm/beos/beos.c +++ b/server/mpm/beos/beos.c @@ -316,6 +316,7 @@ static void process_socket(apr_pool_t *p, apr_socket_t *sock, int my_child_num) if (current_conn) { ap_process_connection(current_conn); + ap_lingering_close(current_conn); } } diff --git a/server/mpm/experimental/perchild/perchild.c b/server/mpm/experimental/perchild/perchild.c index cd3aeb4a7b..909567770a 100644 --- a/server/mpm/experimental/perchild/perchild.c +++ b/server/mpm/experimental/perchild/perchild.c @@ -505,6 +505,7 @@ static void process_socket(apr_pool_t *p, apr_socket_t *sock, long conn_id) current_conn = ap_run_create_connection(p, ap_server_conf, sock, conn_id); if (current_conn) { ap_process_connection(current_conn); + ap_lingering_close(current_conn); } } diff --git a/server/mpm/mpmt_os2/mpmt_os2_child.c b/server/mpm/mpmt_os2/mpmt_os2_child.c index 290a91ea06..7e258d2695 100644 --- a/server/mpm/mpmt_os2/mpmt_os2_child.c +++ b/server/mpm/mpmt_os2/mpmt_os2_child.c @@ -410,6 +410,7 @@ static void worker_main(void *vpArg) if (current_conn) { ap_process_connection(current_conn); + ap_lingering_close(current_conn); } apr_pool_destroy(pconn); diff --git a/server/mpm/netware/mpm_netware.c b/server/mpm/netware/mpm_netware.c index 181d290925..82c6979859 100644 --- a/server/mpm/netware/mpm_netware.c +++ b/server/mpm/netware/mpm_netware.c @@ -508,6 +508,7 @@ got_listener: current_conn = ap_run_create_connection(ptrans, ap_server_conf, csd, my_worker_num); if (current_conn) { ap_process_connection(current_conn); + ap_lingering_close(current_conn); } } diff --git a/server/mpm/perchild/perchild.c b/server/mpm/perchild/perchild.c index cd3aeb4a7b..909567770a 100644 --- a/server/mpm/perchild/perchild.c +++ b/server/mpm/perchild/perchild.c @@ -505,6 +505,7 @@ static void process_socket(apr_pool_t *p, apr_socket_t *sock, long conn_id) current_conn = ap_run_create_connection(p, ap_server_conf, sock, conn_id); if (current_conn) { ap_process_connection(current_conn); + ap_lingering_close(current_conn); } } diff --git a/server/mpm/prefork/prefork.c b/server/mpm/prefork/prefork.c index 83c15d33e7..0d7832404b 100644 --- a/server/mpm/prefork/prefork.c +++ b/server/mpm/prefork/prefork.c @@ -682,6 +682,7 @@ static void child_main(int child_num_arg) current_conn = ap_run_create_connection(ptrans, ap_server_conf, csd, 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 diff --git a/server/mpm/spmt_os2/spmt_os2.c b/server/mpm/spmt_os2/spmt_os2.c index ab530d93c4..f4ad1db881 100644 --- a/server/mpm/spmt_os2/spmt_os2.c +++ b/server/mpm/spmt_os2/spmt_os2.c @@ -682,6 +682,7 @@ static void thread_main(void *thread_num_arg) if (current_conn) { ap_process_connection(current_conn); + ap_lingering_close(current_conn); } } diff --git a/server/mpm/threaded/threaded.c b/server/mpm/threaded/threaded.c index 8dc3cfd998..ad2274d650 100644 --- a/server/mpm/threaded/threaded.c +++ b/server/mpm/threaded/threaded.c @@ -476,6 +476,7 @@ static void process_socket(apr_pool_t *p, apr_socket_t *sock, int my_child_num, current_conn = ap_run_create_connection(p, ap_server_conf, sock, conn_id); if (current_conn) { ap_process_connection(current_conn); + ap_lingering_close(current_conn); } } diff --git a/server/mpm/winnt/mpm_winnt.c b/server/mpm/winnt/mpm_winnt.c index f68d7d5c2c..7f9b75c559 100644 --- a/server/mpm/winnt/mpm_winnt.c +++ b/server/mpm/winnt/mpm_winnt.c @@ -901,9 +901,7 @@ static void worker_main(int thread_num) apr_getsocketopt(context->sock, APR_SO_DISCONNECTED, &disconnected); if (!disconnected) { context->accept_socket = INVALID_SOCKET; - } - else { - apr_pool_cleanup_kill(context->ptrans, c, ap_lingering_close); + ap_lingering_close(c); } } else { diff --git a/server/mpm/worker/worker.c b/server/mpm/worker/worker.c index 662bcdab00..3d0c590c7d 100644 --- a/server/mpm/worker/worker.c +++ b/server/mpm/worker/worker.c @@ -499,6 +499,7 @@ static void process_socket(apr_pool_t *p, apr_socket_t *sock, int my_child_num, current_conn = ap_run_create_connection(p, ap_server_conf, sock, conn_id); if (current_conn) { ap_process_connection(current_conn); + ap_lingering_close(current_conn); } } |