You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@httpd.apache.org by ma...@hyperreal.org on 1999/10/26 01:16:33 UTC

cvs commit: apache-2.0/src/modules/mpm/mpmt_pthread mpmt_pthread.c

manoj       99/10/25 16:16:32

  Modified:    src/modules/mpm/mpmt_pthread mpmt_pthread.c
  Log:
  Fix warnings, and fix a segfault in the process.
  
  Revision  Changes    Path
  1.40      +8 -7      apache-2.0/src/modules/mpm/mpmt_pthread/mpmt_pthread.c
  
  Index: mpmt_pthread.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/modules/mpm/mpmt_pthread/mpmt_pthread.c,v
  retrieving revision 1.39
  retrieving revision 1.40
  diff -u -d -u -r1.39 -r1.40
  --- mpmt_pthread.c	1999/10/24 13:08:28	1.39
  +++ mpmt_pthread.c	1999/10/25 23:16:29	1.40
  @@ -725,7 +725,7 @@
    * Child process main loop.
    */
   
  -static void process_socket(ap_context_t *p, struct sockaddr *sa_client, int csd, int my_child_num, int my_thread_num)
  +static void process_socket(ap_context_t *p, struct sockaddr *sa_client, ap_socket_t *sock, int my_child_num, int my_thread_num)
   {
       struct sockaddr sa_server; /* ZZZZ */
       size_t len = sizeof(struct sockaddr);
  @@ -733,6 +733,9 @@
       conn_rec *current_conn;
       ap_iol *iol;
       long conn_id = my_child_num * HARD_THREAD_LIMIT + my_thread_num;
  +    int csd;
  +
  +    (void) ap_get_os_sock(&csd, sock);
   
       if (getsockname(csd, &sa_server, &len) < 0) { 
   	ap_log_error(APLOG_MARK, APLOG_ERR, errno, server_conf, "getsockname");
  @@ -754,7 +757,7 @@
               ap_log_error(APLOG_MARK, APLOG_WARNING, errno, NULL,
                   "error attaching to socket");
           }
  -        close(csd);
  +        ap_close_socket(sock);
   	return;
       }
   
  @@ -763,7 +766,8 @@
       conn_io = ap_bcreate(p, B_RDWR);
       ap_bpush_iol(conn_io, iol);
   
  -    current_conn = ap_new_apr_connection(p, server_conf, conn_io, csd, conn_id);
  +    current_conn = ap_new_apr_connection(p, server_conf, conn_io, sock,
  +                                         conn_id);
   
       ap_process_connection(current_conn);
   }
  @@ -802,7 +806,6 @@
       ap_socket_t *sd = NULL;
       int n;
       int curr_pollfd, last_pollfd = 0;
  -    int thesock;
       ap_pollfd_t *pollset;
   
       free(ti);
  @@ -891,8 +894,7 @@
               SAFE_ACCEPT(intra_mutex_off(0));
               break;
           }
  -        ap_get_os_sock(&thesock, csd);
  -        process_socket(ptrans, &sa_client, thesock, process_slot, thread_slot);
  +        process_socket(ptrans, &sa_client, csd, process_slot, thread_slot);
           ap_clear_pool(ptrans);
           requests_this_child--;
       }
  @@ -917,7 +919,6 @@
   {
       sigset_t sig_mask;
       int signal_received;
  -    pthread_t thread;
       pthread_attr_t thread_attr;
       int i;
       int my_child_num = child_num_arg;