]> git.sur5r.net Git - openldap/commitdiff
ITS#5886 fix epoll hangup handling
authorHoward Chu <hyc@openldap.org>
Wed, 14 Jan 2009 04:28:24 +0000 (04:28 +0000)
committerHoward Chu <hyc@openldap.org>
Wed, 14 Jan 2009 04:28:24 +0000 (04:28 +0000)
servers/slapd/connection.c
servers/slapd/daemon.c
servers/slapd/proto-slap.h

index 98a2432c5fffd8ba926cf9c457a1ccecbbcf1e1a..179025a9f0e9fd8a3d63e4643d04982cf1b4ddb7 100644 (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 )
 {
index fea9d35e2324ee5f9c57fda37ecb9922e10d709a..0c12c1a3ef47d4b9b60c36eb990857b78a8a2ed8 100644 (file)
@@ -2544,6 +2544,7 @@ slapd_daemon_task(
                                } else {
                                        Debug( LDAP_DEBUG_CONNS,
                                                "daemon: hangup on %d\n", fd, 0, 0 );
+                                       connection_hangup( fd );
                                }
                        }
                }
index 5d07c4c259e5ef59a158b501552d38ba7128fab7..4b17b54a59f942ac9a4ee271118178339f09a4a9 100644 (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));