ITS#5886 fix epoll hangup handling

This commit is contained in:
Howard Chu 2009-01-14 04:28:24 +00:00
parent f54bb377df
commit 96192064f3
3 changed files with 16 additions and 0 deletions

View File

@ -1249,6 +1249,20 @@ int connection_read_activate( ber_socket_t s )
return rc;
}
/* Used for epoll / event functions that distinguish hangups from read events */
void
connection_hangup( ber_socket_t s )
{
Connection *c;
c = connection_get( s );
if ( c ) {
connection_closing( c, "connection lost" );
connection_close( c );
connection_return( c );
}
}
static int
connection_read( ber_socket_t s, conn_readinfo *cri )
{

View File

@ -2544,6 +2544,7 @@ slapd_daemon_task(
} else {
Debug( LDAP_DEBUG_CONNS,
"daemon: hangup on %d\n", fd, 0, 0 );
connection_hangup( fd );
}
}
}

View File

@ -745,6 +745,7 @@ LDAP_SLAPD_F (Connection *) connection_init LDAP_P((
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_state_closing LDAP_P(( Connection *c ));
LDAP_SLAPD_F (const char *) connection_state2str LDAP_P(( int state ))
LDAP_GCCATTR((const));