]> git.sur5r.net Git - openldap/blobdiff - servers/slapd/daemon.c
Partial revert of f30269f5d2e4bb5ee7486fe6542078d1b59dba6d
[openldap] / servers / slapd / daemon.c
index 46a07a6f519c06d6d2504534e17fe009a39eaeac..2a75f91753ac3fc152e2b735a0935ba63cb0e8ce 100644 (file)
@@ -1,7 +1,7 @@
 /* $OpenLDAP$ */
 /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
  *
- * Copyright 1998-2011 The OpenLDAP Foundation.
+ * Copyright 1998-2012 The OpenLDAP Foundation.
  * Portions Copyright 2007 by Howard Chu, Symas Corporation.
  * All rights reserved.
  *
@@ -2129,7 +2129,7 @@ slapd_daemon_task(
        int l;
        time_t last_idle_check = 0;
        int ebadf = 0;
-       int tid = (int)ptr;
+       int tid = *(int *)ptr;
 
 #define SLAPD_IDLE_CHECK_LIMIT 4
 
@@ -2784,25 +2784,22 @@ loop:
                                        }
                                }
                                /* If event is a read */
-                               if ( SLAP_EVENT_IS_READ( i ))
+                               if ( SLAP_EVENT_IS_READ( i )) {
                                        r = 1;
-                               if ( r || !w ) {
                                        Debug( LDAP_DEBUG_CONNS,
                                                "daemon: read active on %d\n",
                                                fd, 0, 0 );
 
-                                       if ( r ) {
-                                               SLAP_EVENT_CLR_READ( i );
-                                       } else {
+                                       SLAP_EVENT_CLR_READ( i );
+                                       connection_read_activate( fd );
+                               } else if ( !w ) {
 #ifdef HAVE_EPOLL
-                                               /* Don't keep reporting the hangup
-                                                */
-                                               if ( SLAP_SOCK_IS_ACTIVE( tid, fd )) {
-                                                       SLAP_EPOLL_SOCK_SET( tid, fd, EPOLLET );
-                                               }
-#endif
+                                       /* Don't keep reporting the hangup
+                                        */
+                                       if ( SLAP_SOCK_IS_ACTIVE( tid, fd )) {
+                                               SLAP_EPOLL_SOCK_SET( tid, fd, EPOLLET );
                                        }
-                                       connection_read_activate( fd );
+#endif
                                }
                        }
                }
@@ -2919,7 +2916,7 @@ slapd_daemon( void )
        {
                /* listener as a separate THREAD */
                rc = ldap_pvt_thread_create( &listener_tid[i],
-                       0, slapd_daemon_task, (void *)i );
+                       0, slapd_daemon_task, (void *)&i );
 
                if ( rc != 0 ) {
                        Debug( LDAP_DEBUG_ANY,