for ( i = 0; slapd_srvurls[i] != NULL; i++ ) {
if ( strcmp( slapd_srvurls[i], "ldap:///" ) == 0 ) {
slapd_srvurls[i] = (char *) ch_realloc( slapd_srvurls[i],
- strlen( global_host ) +
+ global_host_bv.bv_len +
sizeof( LDAP_SRVTYPE_PREFIX ) );
strcpy( lutil_strcopy(slapd_srvurls[i],
- LDAP_SRVTYPE_PREFIX ), global_host );
+ LDAP_SRVTYPE_PREFIX ), global_host_bv.bv_val );
} else if ( strcmp( slapd_srvurls[i], "ldaps:///" ) == 0 ) {
slapd_srvurls[i] = (char *) ch_realloc( slapd_srvurls[i],
- strlen( global_host ) +
+ global_host_bv.bv_len +
sizeof( LDAPS_SRVTYPE_PREFIX ) );
strcpy( lutil_strcopy(slapd_srvurls[i],
- LDAPS_SRVTYPE_PREFIX ), global_host );
+ LDAPS_SRVTYPE_PREFIX ), global_host_bv.bv_val );
}
}
#endif /* LDAP_DEBUG */
for ( i = 0; i < ns; i++ ) {
- int rc = 1, fd, w = 0;
+ int rc = 1, fd, w = 0, r = 0;
if ( SLAP_EVENT_IS_LISTENER( i ) ) {
rc = slap_listener_activate( SLAP_EVENT_LISTENER( i ) );
}
}
/* 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 );
- SLAP_EVENT_CLR_READ( i );
- connection_read_activate( fd );
- } else if ( !w ) {
- Debug( LDAP_DEBUG_CONNS,
- "daemon: hangup on %d\n", fd, 0, 0 );
- if ( SLAP_SOCK_IS_ACTIVE( fd )) {
+ if ( r ) {
+ SLAP_EVENT_CLR_READ( i );
+ } else {
#ifdef HAVE_EPOLL
/* Don't keep reporting the hangup
*/
- SLAP_EPOLL_SOCK_SET( fd, EPOLLET );
+ if ( SLAP_SOCK_IS_ACTIVE( fd )) {
+ SLAP_EPOLL_SOCK_SET( fd, EPOLLET );
+ }
#endif
- connection_hangup( fd );
}
+ connection_read_activate( fd );
}
}
}