return rc;
}
-void
-connection_hangup( ber_socket_t s )
-{
- Connection *c;
-
- c = connection_get( s );
- if ( c ) {
- if ( c->c_conn_state == SLAP_C_CLIENT ) {
- connection_return( c );
- connection_read_activate( s );
- } else {
- connection_closing( c, "connection lost" );
- connection_close( c );
- connection_return( c );
- }
- }
-}
-
static int
connection_read( ber_socket_t s, conn_readinfo *cri )
{
#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 );
#endif
- connection_hangup( fd );
}
+ connection_read_activate( fd );
}
}
}
LDAP_SLAPD_F (void) connection_closing LDAP_P((
Connection *c, const char *why ));
-LDAP_SLAPD_F (void) connection_hangup LDAP_P(( ber_socket_t fd ));
LDAP_SLAPD_F (int) connection_valid LDAP_P(( Connection *c ));
LDAP_SLAPD_F (const char *) connection_state2str LDAP_P(( int state ))
LDAP_GCCATTR((const));