httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From b..@apache.org
Subject cvs commit: httpd-2.0/server/mpm/mpmt_os2 mpmt_os2_child.c
Date Thu, 20 Nov 2003 22:28:15 GMT
bjh         2003/11/20 14:28:15

  Modified:    server/mpm/mpmt_os2 mpmt_os2_child.c
  Log:
  Rework OS/2 MPM to use the pollset API.
  
  Revision  Changes    Path
  1.27      +21 -38    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.26
  retrieving revision 1.27
  diff -u -r1.26 -r1.27
  --- mpmt_os2_child.c	3 Sep 2003 19:27:11 -0000	1.26
  +++ mpmt_os2_child.c	20 Nov 2003 22:28:15 -0000	1.27
  @@ -134,15 +134,13 @@
   void ap_mpm_child_main(apr_pool_t *pconf)
   {
       ap_listen_rec *lr = NULL;
  -    ap_listen_rec *first_lr = NULL;
       int requests_this_child = 0;
  -    apr_socket_t *sd = ap_listeners->sd;
  -    int nsds, rv = 0;
  +    int rv = 0;
       unsigned long ulTimes;
       int my_pid = getpid();
       ULONG rc, c;
       HQUEUE workq;
  -    apr_pollfd_t *pollset;
  +    apr_pollset_t *pollset;
       int num_listeners;
       TID server_maint_tid;
       void *sb_mem;
  @@ -223,16 +221,23 @@
           num_listeners++;
       }
   
  -    apr_poll_setup(&pollset, num_listeners, pchild);
  +    apr_pollset_create(&pollset, num_listeners, pchild, 0);
   
  -    for (lr = ap_listeners; lr; lr = lr->next) {
  -        apr_poll_socket_add(pollset, lr->sd, APR_POLLIN);
  +    for (lr = ap_listeners; lr != NULL; lr = lr->next) {
  +        apr_pollfd_t pfd = { 0 };
  +
  +        pfd.desc_type = APR_POLL_SOCKET;
  +        pfd.desc.s = lr->sd;
  +        pfd.reqevents = APR_POLLIN;
  +        pfd.client_data = lr;
  +        apr_pollset_add(pollset, &pfd);
       }
   
       /* Main connection accept loop */
       do {
           apr_pool_t *pconn;
           worker_args_t *worker_args;
  +        int last_poll_idx = 0;
   
           apr_pool_create(&pconn, pchild);
           worker_args = apr_palloc(pconn, sizeof(worker_args_t));
  @@ -241,6 +246,9 @@
           if (num_listeners == 1) {
               rv = apr_socket_accept(&worker_args->conn_sd, ap_listeners->sd, pconn);
           } else {
  +            const apr_pollfd_t *poll_results;
  +            apr_int32_t num_poll_results;
  +
               rc = DosRequestMutexSem(ap_mpm_accept_mutex, SEM_INDEFINITE_WAIT);
   
               if (shutdown_pending) {
  @@ -251,43 +259,18 @@
               rv = APR_FROM_OS_ERROR(rc);
   
               if (rv == APR_SUCCESS) {
  -                rv = apr_poll(pollset, num_listeners, &nsds, -1);
  +                rv = apr_pollset_poll(pollset, -1, &num_poll_results, &poll_results);
                   DosReleaseMutexSem(ap_mpm_accept_mutex);
               }
   
               if (rv == APR_SUCCESS) {
  -                if (first_lr == NULL) {
  -                    first_lr = ap_listeners;
  -                }
  -
  -                lr = first_lr;
  -
  -                do {
  -                    apr_int16_t event;
  -
  -                    apr_poll_revents_get(&event, lr->sd, pollset);
  -
  -                    if (event == APR_POLLIN) {
  -                        apr_sockaddr_t *sa;
  -                        apr_port_t port;
  -                        apr_socket_addr_get(&sa, APR_LOCAL, lr->sd);
  -                        apr_sockaddr_port_get(&port, sa);
  -                        first_lr = lr->next;
  -                        break;
  -                    }
  -                    lr = lr->next;
  -
  -                    if (!lr) {
  -                        lr = ap_listeners;
  -                    }
  -                } while (lr != first_lr);
  -
  -                if (lr == first_lr) {
  -                    continue;
  +                if (last_poll_idx >= num_listeners) {
  +                    last_poll_idx = 0;
                   }
   
  -                sd = lr->sd;
  -                rv = apr_socket_accept(&worker_args->conn_sd, sd, pconn);
  +                lr = poll_results[last_poll_idx++].client_data;
  +                rv = apr_socket_accept(&worker_args->conn_sd, lr->sd, pconn);
  +                last_poll_idx++;
               }
           }
   
  
  
  

Mime
View raw message