#include "ldap_rq.h"
+#undef HAVE_EPOLL
+
#if defined(HAVE_SYS_EPOLL_H) && defined(HAVE_EPOLL)
#include <sys/epoll.h>
#endif
time_t starttime;
ber_socket_t dtblsize;
slap_ssf_t local_ssf = LDAP_PVT_SASL_LOCAL_SSF;
+struct runqueue_s slapd_rq;
Listener **slap_listeners = NULL;
else
tvp = NULL;
- ldap_pvt_thread_mutex_lock( &syncrepl_rq.rq_mutex );
- rtask = ldap_pvt_runqueue_next_sched( &syncrepl_rq, &cat );
+ ldap_pvt_thread_mutex_lock( &slapd_rq.rq_mutex );
+ rtask = ldap_pvt_runqueue_next_sched( &slapd_rq, &cat );
while ( cat && cat->tv_sec && cat->tv_sec <= now ) {
- if ( ldap_pvt_runqueue_isrunning( &syncrepl_rq, rtask )) {
- ldap_pvt_runqueue_resched( &syncrepl_rq, rtask, 0 );
+ if ( ldap_pvt_runqueue_isrunning( &slapd_rq, rtask )) {
+ ldap_pvt_runqueue_resched( &slapd_rq, rtask, 0 );
} else {
- ldap_pvt_runqueue_runtask( &syncrepl_rq, rtask );
- ldap_pvt_runqueue_resched( &syncrepl_rq, rtask, 0 );
- ldap_pvt_thread_mutex_unlock( &syncrepl_rq.rq_mutex );
+ ldap_pvt_runqueue_runtask( &slapd_rq, rtask );
+ ldap_pvt_runqueue_resched( &slapd_rq, rtask, 0 );
+ ldap_pvt_thread_mutex_unlock( &slapd_rq.rq_mutex );
ldap_pvt_thread_pool_submit( &connection_pool,
rtask->routine, (void *) rtask );
- ldap_pvt_thread_mutex_lock( &syncrepl_rq.rq_mutex );
+ ldap_pvt_thread_mutex_lock( &slapd_rq.rq_mutex );
}
- rtask = ldap_pvt_runqueue_next_sched( &syncrepl_rq, &cat );
+ rtask = ldap_pvt_runqueue_next_sched( &slapd_rq, &cat );
}
- ldap_pvt_thread_mutex_unlock( &syncrepl_rq.rq_mutex );
+ ldap_pvt_thread_mutex_unlock( &slapd_rq.rq_mutex );
if ( cat != NULL ) {
time_t diff = difftime( cat->tv_sec, now );
/* FALL THRU */
}
- /* We don't need to examine the event status for wake_sds;
- * if waking is set and we woke up, we'll read whatever
- * we can.
- */
- if ( waking ) {
+#if SLAP_EVENTS_ARE_INDEXED
+ if ( SLAP_EVENT_IS_READ( wake_sds[0] )) {
char c[BUFSIZ];
tcp_read( wake_sds[0], c, sizeof(c) );
waking = 0;
ns--;
+ SLAP_EVENT_CLR_READ( wake_sds[0] );
continue;
}
-#if SLAP_EVENTS_ARE_INDEXED
/* The event slot equals the descriptor number - this is
* true for Unix select and poll. We treat Windows select
* like this too, even though it's a kludge.
* all other connections last (as we do for select), we would need
* to use multiple event handles and cascade them.
*
- * That seems like a bit of hassle. So the wake_sds check has moved
- * above. For epoll and kqueue we can associate arbitrary data with
+ * That seems like a bit of hassle. So the wake_sds check has been
+ * skipped. For epoll and kqueue we can associate arbitrary data with
* an event, so we could use pointers to the listener structure
* instead of just the file descriptor. For /dev/poll we have to
* search the listeners array for a matching descriptor.
*/
+ /* if waking is set and we woke up, we'll read whatever
+ * we can.
+ */
+ if ( waking ) {
+ char c[BUFSIZ];
+ tcp_read( wake_sds[0], c, sizeof(c) );
+ waking = 0;
+ ns--;
+ continue;
+ }
+
#ifdef LDAP_DEBUG
Debug( LDAP_DEBUG_CONNS, "daemon: activity on:", 0, 0, 0 );