[Date Prev][Date Next]
[Chronological]
[Thread]
[Top]
Terminating the client connection
I have found during testing of the NT port that if the client application (I
was testing with ldapsearch) abnormally terminated (with ctrl-c on NT), the
thread processing the client request continued running on the slapd server.
I experimented for a while with finding the best way to handle this and have
settled on the following changed connection_close() modifications.
Essentially what I do is set the abandon flag for each active operation on
the connection. I'm not sure if the same should be done for those operations
pointed to by Connection.c_pending_ops
static void connection_close( Connection *c )
{
struct slap_op *o;
assert( connections != NULL );
assert( c != NULL );
assert( c->c_struct_state == SLAP_C_USED );
assert( c->c_conn_state == SLAP_C_CLOSING );
if( c->c_ops != NULL ) {
// ++PAUL added these lines to try to get everything on the
// server to stop if the client abnormally disconnects
// abandon any outstanding ops
o = c->c_ops->o_next;
while ( o != NULL )
{
ldap_pvt_thread_mutex_lock( &o->o_abandonmutex );
o->o_abandon = 1;
ldap_pvt_thread_mutex_unlock( &o->o_abandonmutex );
o = o->o_next;
}
ldap_pvt_thread_mutex_lock( &c->c_ops->o_abandonmutex );
c->c_ops->o_abandon = 1;
ldap_pvt_thread_mutex_unlock( &c->c_ops->o_abandonmutex );
// --PAUL
Debug( LDAP_DEBUG_TRACE,
"connection_close: deferring conn=%ld sd=%d.\n",
c->c_connid, c->c_sb.sb_sd, 0 );
return;
}
Debug( LDAP_DEBUG_TRACE, "connection_close: conn=%ld sd=%d.\n",
c->c_connid, c->c_sb.sb_sd, 0 );
connection_destroy( c );
}
+------------------------------------------------------------------+
| Paul Higgs (NA/EBC/PEEW/F) |
| Ericsson Business Networks AB tel: +46 (8) 4221734 |
| S131 89 Stockholm, Sweden fax: +46 (8) 4221010 |
| Office: Augustendalsvagan 21 |
| Nacka Strand e-mail: paul.higgs@ebc.ericsson.se |
+------------------------------------------------------------------+