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 |
/* |
/* |
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) { |