/* We were approached from the connection list */
assert( IS_ALIVE( c, c_refcnt ) );
+ /* Need to acquire this first, even if we won't need it */
+ checked_lock( &c->c_io_mutex );
CONNECTION_LOCK(c);
+
+ /* Only if it's a client */
+ if ( c->c_state == LLOAD_C_OPEN && c->c_destroy == clients_destroy ) {
+ if ( c->c_pendingber != NULL ||
+ (c->c_pendingber = ber_alloc()) != NULL ) {
+ ber_printf( c->c_pendingber, "t{tit{esss}}", LDAP_TAG_MESSAGE,
+ LDAP_TAG_MSGID, LDAP_RES_UNSOLICITED,
+ LDAP_RES_EXTENDED, LDAP_UNAVAILABLE, "",
+ "connection closing", LDAP_NOTICE_OF_DISCONNECTION );
+ }
+ }
+ checked_unlock( &c->c_io_mutex );
+
if ( !gentle || !c->c_ops ) {
CONNECTION_DESTROY(c);
return LDAP_SUCCESS;