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 )
 {
 
                                } else {
                                        Debug( LDAP_DEBUG_CONNS,
                                                "daemon: hangup on %d\n", fd, 0, 0 );
+                                       connection_hangup( 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_state_closing LDAP_P(( Connection *c ));
 LDAP_SLAPD_F (const char *) connection_state2str LDAP_P(( int state ))
        LDAP_GCCATTR((const));