diff --git a/CHANGES b/CHANGES
index dd9bbfe16adbb7e96b0642bedfe0fed4b6fd4bbe..400ce62cfe9307217b0bf2fe4ad2f998d665a79b 100644
--- a/CHANGES
+++ b/CHANGES
@@ -13,6 +13,7 @@ OpenLDAP 2.4.17 Engineering
 	Fixed slapd cert validation (ITS#6098)
 	Fixed slapd errno handling (ITS#6037)
 	Fixed slapd global alloc handling (ITS#6054)
+	Fixed slapd ldapi issues (ITS#6056)
 	Fixed slapd moduleload with static backends and modules (ITS#6016)
 	Fixed slapd normalization of updated schema attributes (ITS#5540)
 	Fixed slapd olcLimits handling (ITS#6159)
diff --git a/servers/slapd/connection.c b/servers/slapd/connection.c
index 4e5ccd5fbdd1890216de452c14855885e2837a3b..bf7f68c1ce1073b3f081bcc8315f870d6051c23f 100644
--- a/servers/slapd/connection.c
+++ b/servers/slapd/connection.c
@@ -1271,24 +1271,6 @@ int connection_read_activate( ber_socket_t s )
 	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 )
 {
diff --git a/servers/slapd/daemon.c b/servers/slapd/daemon.c
index 55681f47124044d5e29832d0cd16ac224f9bf808..2fcfcebb5e77f95701a79b9de579d18720e1e8da 100644
--- a/servers/slapd/daemon.c
+++ b/servers/slapd/daemon.c
@@ -2529,7 +2529,7 @@ slapd_daemon_task(
 #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 ) );
@@ -2569,24 +2569,23 @@ slapd_daemon_task(
 					}
 				}
 				/* 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 );
 				}
 			}
 		}
diff --git a/servers/slapd/proto-slap.h b/servers/slapd/proto-slap.h
index e8b73c71b5f70085395621ef603d0a3be88d3795..5d77594cfa42815833b8664796101f88245a1e7f 100644
--- a/servers/slapd/proto-slap.h
+++ b/servers/slapd/proto-slap.h
@@ -758,7 +758,6 @@ 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_valid LDAP_P(( Connection *c ));
 LDAP_SLAPD_F (const char *) connection_state2str LDAP_P(( int state ))
 	LDAP_GCCATTR((const));