rbb         99/02/18 10:17:42

  Modified:    pthreads/src/main http_main.c
  Log:
  This patch keeps our server accepting connections over restarts.  It basically
  puts back in logic from 1.3 that was taken out because of other bugs getting
  in the way of our restarts keeping their sockets available for re-use.
  
  Revision  Changes    Path
  1.47      +7 -9      apache-apr/pthreads/src/main/http_main.c
  
  Index: http_main.c
  ===================================================================
  RCS file: /home/cvs/apache-apr/pthreads/src/main/http_main.c,v
  retrieving revision 1.46
  retrieving revision 1.47
  diff -u -r1.46 -r1.47
  --- http_main.c       1999/02/18 18:06:49     1.46
  +++ http_main.c       1999/02/18 18:17:41     1.47
  @@ -1942,9 +1942,8 @@
            exit(1);
        }
        *nr = *lr;
  -     ap_kill_cleanups_for_socket(p, nr->fd); 
  -     nr->next = old_listeners;
  -     nr->used = 1;
  +     ap_kill_cleanups_for_socket(p, nr->fd);
  +        nr->next = old_listeners;
        old_listeners = nr;
        lr = lr->next;
       } while (lr && lr != ap_listeners);
  @@ -1956,20 +1955,21 @@
       listen_rec *or;
       for (or = old_listeners; or; or = or->next) {
        if (!memcmp(&or->local_addr, &lr->local_addr, sizeof(or->local_addr))) {
  -         return or->fd;
  +         or->used = 1;
  +            return or->fd;
        }
       }
       return -1;
   }
   
   
  -static void close_unused_listeners(void)
  +static void close_unused_listeners()
   {
       listen_rec *or, *next;
   
       for (or = old_listeners; or; or = next) {
        next = or->next;
  -     if (!or->used)
  +     if (!or->used) 
            closesocket(or->fd);
        free(or);
       }
  @@ -1992,7 +1992,7 @@
            fd = make_sock(p, &lr->local_addr);
        }
        else {
  -         ap_note_cleanups_for_fd(p, fd);
  +         ap_note_cleanups_for_socket(p, fd);
        }
        if (fd >= 0) {
               ++num_listenfds;
  @@ -2492,7 +2492,6 @@
            my_info->pid = my_child_num;
            my_info->tid = i++;
            my_info->sd = lr->fd;
  -         lr->used = 1;
   
            if (pthread_create(&thread, NULL, accept_thread, my_info)) {
                ap_log_error(APLOG_MARK, APLOG_ALERT, server_conf,
  @@ -2522,7 +2521,6 @@
       my_info->pid = my_child_num;
       my_info->tid = i;
       my_info->sd = lr->fd;
  -    lr->used = 1;
       
       accept_thread(my_info);
   }
  
  
  

Reply via email to