static void
connection_destroy( Connection *c )
{
- ber_socket_t sd;
+ ber_socket_t sd, inval = AC_SOCKET_INVALID;
unsigned long connid;
const char *close_reason;
Sockbuf *sb;
ber_sockbuf_ctrl( sb, LBER_SB_OPT_GET_FD, &sd );
slapd_sd_lock();
+ ber_sockbuf_ctrl( c->c_sb, LBER_SB_OPT_SET_FD, &inval );
ber_sockbuf_free( sb );
/* c must be fully reset by this point; when we call slapd_remove
ber_socket_t s )
{
Connection *c;
+ ber_socket_t inval = AC_SOCKET_INVALID;
/* get (locked) connection */
c = connection_get( s );
c->c_struct_state = SLAP_C_UNUSED;
c->c_close_reason = "?"; /* should never be needed */
slapd_sd_lock();
+ ber_sockbuf_ctrl( c->c_sb, LBER_SB_OPT_SET_FD, &inval );
ber_sockbuf_free( c->c_sb );
slapd_remove( s, 0, 1, 1 );
c->c_sb = ber_sockbuf_alloc( );
SLAP_DEL_SOCK(s);
+ tcp_close(s);
+
/* If we ran out of file descriptors, we dropped a listener from
* the select() loop. Now that we're removing a session from our
* control, we can try to resume a dropped listener to use.