From: Ryan Bloom Date: Tue, 13 Nov 2001 02:09:07 +0000 (+0000) Subject: Cleanup some code that was created during the abstration. This basically X-Git-Tag: 2.0.29~165 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=44baa0367f26c924c7e77177b828eee5a33a29a2;p=thirdparty%2Fapache%2Fhttpd.git Cleanup some code that was created during the abstration. This basically takes the old ap_new_connection, and puts into the new core_create_conn function. There is no good reason to have two functions to do this. git-svn-id: https://svn.apache.org/repos/asf/httpd/httpd/trunk@91890 13f79535-47bb-0310-9956-ffa450edef68 --- diff --git a/include/http_connection.h b/include/http_connection.h index cb13d29fff7..8b497d53fa6 100644 --- a/include/http_connection.h +++ b/include/http_connection.h @@ -131,15 +131,7 @@ AP_DECLARE_HOOK(int,process_connection,(conn_rec *c)) /** */ AP_DECLARE_HOOK(conn_rec *, create_connection, - (apr_pool_t *p, apr_socket_t *csd, int child_num)) - -/* This is NOT staying here. It is necessary to quiet warnings - * while I would on the next patch. rbb - */ - -AP_CORE_DECLARE(conn_rec *)ap_core_new_connection(apr_pool_t *p, - server_rec *server, apr_socket_t *inout, - core_net_rec *net, long id); + (apr_pool_t *p, apr_socket_t *csd, int conn_ed)) #ifdef __cplusplus } diff --git a/server/connection.c b/server/connection.c index e5344d94400..2d379d2063d 100644 --- a/server/connection.c +++ b/server/connection.c @@ -82,8 +82,8 @@ APR_HOOK_STRUCT( AP_IMPLEMENT_HOOK_RUN_ALL(int,pre_connection,(conn_rec *c),(c),OK,DECLINED) AP_IMPLEMENT_HOOK_RUN_FIRST(int,process_connection,(conn_rec *c),(c),DECLINED) AP_IMPLEMENT_HOOK_RUN_FIRST(conn_rec *,create_connection, - (apr_pool_t *p, apr_socket_t *csd, int my_child_num), - (p, csd, my_child_num), NULL) + (apr_pool_t *p, apr_socket_t *csd, int conn_id), + (p, csd, conn_id), NULL) /* * More machine-dependent networking gooo... on some systems, @@ -222,51 +222,3 @@ AP_CORE_DECLARE(void) ap_process_connection(conn_rec *c) ap_run_process_connection(c); } - -/* Clearly some of this stuff doesn't belong in a generalised connection - structure, but for now... -*/ - -AP_CORE_DECLARE(conn_rec *)ap_core_new_connection(apr_pool_t *p, - server_rec *server, apr_socket_t *inout, - core_net_rec *net, long id) -{ - conn_rec *conn = (conn_rec *) apr_pcalloc(p, sizeof(conn_rec)); - apr_status_t rv; - - (void) ap_update_child_status(AP_CHILD_THREAD_FROM_ID(id), - SERVER_BUSY_READ, (request_rec *) NULL); - - /* Got a connection structure, so initialize what fields we can - * (the rest are zeroed out by pcalloc). - */ - - conn->conn_config=ap_create_conn_config(p); - conn->notes = apr_table_make(p, 5); - - conn->pool = p; - if ((rv = apr_socket_addr_get(&conn->local_addr, APR_LOCAL, inout)) - != APR_SUCCESS) { - ap_log_error(APLOG_MARK, APLOG_INFO, rv, server, - "apr_socket_addr_get(APR_LOCAL)"); - apr_socket_close(inout); - return NULL; - } - apr_sockaddr_ip_get(&conn->local_ip, conn->local_addr); - if ((rv = apr_socket_addr_get(&conn->remote_addr, APR_REMOTE, inout)) - != APR_SUCCESS) { - ap_log_error(APLOG_MARK, APLOG_INFO, rv, server, - "apr_socket_addr_get(APR_REMOTE)"); - apr_socket_close(inout); - return NULL; - } - apr_sockaddr_ip_get(&conn->remote_ip, conn->remote_addr); - conn->base_server = server; - net->client_socket = inout; - - conn->id = id; - - apr_pool_cleanup_register(p, net, ap_lingering_close, apr_pool_cleanup_null); - - return conn; -} diff --git a/server/core.c b/server/core.c index fa5bce97ed5..84ad3b1b7fd 100644 --- a/server/core.c +++ b/server/core.c @@ -3277,9 +3277,10 @@ static int core_create_proxy_req(request_rec *r, request_rec *pr) } static conn_rec *core_create_conn(apr_pool_t *ptrans, apr_socket_t *csd, - int my_child_num) + int conn_id) { core_net_rec *net = apr_palloc(ptrans, sizeof(*net)); + apr_status_t rv; #ifdef AP_MPM_DISABLE_NAGLE_ACCEPTED_SOCK ap_sock_disable_nagle(csd); @@ -3287,9 +3288,42 @@ static conn_rec *core_create_conn(apr_pool_t *ptrans, apr_socket_t *csd, net->in_ctx = NULL; net->out_ctx = NULL; - net->c = ap_core_new_connection(ptrans, ap_server_conf, csd, - net, my_child_num); - + net->c = (conn_rec *) apr_pcalloc(ptrans, sizeof(conn_rec)); + + (void) ap_update_child_status(AP_CHILD_THREAD_FROM_ID(conn_id), + SERVER_BUSY_READ, (request_rec *) NULL); + + /* Got a connection structure, so initialize what fields we can + * (the rest are zeroed out by pcalloc). + */ + + net->c->conn_config=ap_create_conn_config(ptrans); + net->c->notes = apr_table_make(ptrans, 5); + + net->c->pool = ptrans; + if ((rv = apr_socket_addr_get(&net->c->local_addr, APR_LOCAL, csd)) + != APR_SUCCESS) { + ap_log_error(APLOG_MARK, APLOG_INFO, rv, ap_server_conf, + "apr_socket_addr_get(APR_LOCAL)"); + apr_socket_close(csd); + return NULL; + } + apr_sockaddr_ip_get(&net->c->local_ip, net->c->local_addr); + if ((rv = apr_socket_addr_get(&net->c->remote_addr, APR_REMOTE, csd)) + != APR_SUCCESS) { + ap_log_error(APLOG_MARK, APLOG_INFO, rv, ap_server_conf, + "apr_socket_addr_get(APR_REMOTE)"); + apr_socket_close(csd); + return NULL; + } + apr_sockaddr_ip_get(&net->c->remote_ip, net->c->remote_addr); + net->c->base_server = ap_server_conf; + net->client_socket = csd; + + net->c->id = conn_id; + + apr_pool_cleanup_register(ptrans, net, ap_lingering_close, apr_pool_cleanup_null); + ap_add_input_filter("CORE_IN", net, NULL, net->c); ap_add_output_filter("CORE", net, NULL, net->c); return net->c;