You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by rb...@apache.org on 2001/11/13 03:09:07 UTC

cvs commit: httpd-2.0/server connection.c core.c

rbb         01/11/12 18:09:07

  Modified:    include  http_connection.h
               server   connection.c core.c
  Log:
  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.
  
  Revision  Changes    Path
  1.41      +1 -9      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.40
  retrieving revision 1.41
  diff -u -r1.40 -r1.41
  --- http_connection.h	2001/11/12 23:49:06	1.40
  +++ http_connection.h	2001/11/13 02:09:07	1.41
  @@ -131,15 +131,7 @@
   /**
    */
   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
   }
  
  
  
  1.88      +2 -50     httpd-2.0/server/connection.c
  
  Index: connection.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/server/connection.c,v
  retrieving revision 1.87
  retrieving revision 1.88
  diff -u -r1.87 -r1.88
  --- connection.c	2001/11/12 23:49:06	1.87
  +++ connection.c	2001/11/13 02:09:07	1.88
  @@ -82,8 +82,8 @@
   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,
  @@ -221,52 +221,4 @@
   
       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;
   }
  
  
  
  1.91      +38 -4     httpd-2.0/server/core.c
  
  Index: core.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/server/core.c,v
  retrieving revision 1.90
  retrieving revision 1.91
  diff -u -r1.90 -r1.91
  --- core.c	2001/11/13 01:24:41	1.90
  +++ core.c	2001/11/13 02:09:07	1.91
  @@ -3277,9 +3277,10 @@
   }
   
   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 @@
   
       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;