/[hydra]/hydra/src/request.c
ViewVC logotype

Diff of /hydra/src/request.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.2 by nmav, Sun Sep 22 09:07:57 2002 UTC revision 1.3 by nmav, Mon Sep 23 07:43:32 2002 UTC
# Line 70  request *new_request(server_params* para Line 70  request *new_request(server_params* para
70  }  }
71    
72  #ifdef ENABLE_SMP  #ifdef ENABLE_SMP
73   static pthread_mutex_t accept_mutex  = PTHREAD_MUTEX_INITIALIZER;   static pthread_mutex_t accept_mutex[2]  = {
74            PTHREAD_MUTEX_INITIALIZER, PTHREAD_MUTEX_INITIALIZER };
75  #endif  #endif
76    
77  /*  /*
# Line 94  void get_request(server_params* params, Line 95  void get_request(server_params* params,
95      remote_addr.S_FAMILY = 0xdead;      remote_addr.S_FAMILY = 0xdead;
96            
97  #ifdef ENABLE_SMP  #ifdef ENABLE_SMP
98      pthread_mutex_lock( &accept_mutex);      /* here we make use of the fact that server_s.secure is
99  #if 0 /* this is slower! */       * 0 or 1, and we have 2 mutexes, one for the secure port,
100      if ( pthread_mutex_trylock( &accept_mutex) == EBUSY) {       * and one of the normal http port.
101              /* no requests we could handle */       */
102              server_s.pending_requests = 0;      pthread_mutex_lock( &accept_mutex[ server_s.secure]);
         return;  
    }  
 #endif  
103  #endif  #endif
104    
105      fd = accept(server_s.socket, (struct sockaddr *) &remote_addr,      fd = accept(server_s.socket, (struct sockaddr *) &remote_addr,
106                  &remote_addrlen);                  &remote_addrlen);
107    
108  #ifdef ENABLE_SMP  #ifdef ENABLE_SMP
109      pthread_mutex_unlock( &accept_mutex);      pthread_mutex_unlock( &accept_mutex[ server_s.secure]);
110  #endif  #endif
111    
112      if (fd == -1) {      if (fd == -1) {

Legend:
Removed from v.1.2  
changed lines
  Added in v.1.3

webmaster@linux.gr
ViewVC Help
Powered by ViewVC 1.1.26