From: Howard Chu Date: Wed, 14 Jan 2009 04:28:24 +0000 (+0000) Subject: ITS#5886 fix epoll hangup handling X-Git-Tag: ACLCHECK_0~1010 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=96192064f3a3daea994eb8293f0413def5379958;p=openldap ITS#5886 fix epoll hangup handling --- diff --git a/servers/slapd/connection.c b/servers/slapd/connection.c index 98a2432c5f..179025a9f0 100644 --- a/servers/slapd/connection.c +++ b/servers/slapd/connection.c @@ -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 ) { diff --git a/servers/slapd/daemon.c b/servers/slapd/daemon.c index fea9d35e23..0c12c1a3ef 100644 --- a/servers/slapd/daemon.c +++ b/servers/slapd/daemon.c @@ -2544,6 +2544,7 @@ slapd_daemon_task( } else { Debug( LDAP_DEBUG_CONNS, "daemon: hangup on %d\n", fd, 0, 0 ); + connection_hangup( fd ); } } } diff --git a/servers/slapd/proto-slap.h b/servers/slapd/proto-slap.h index 5d07c4c259..4b17b54a59 100644 --- a/servers/slapd/proto-slap.h +++ b/servers/slapd/proto-slap.h @@ -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));