X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=servers%2Fslapd%2Fconnection.c;h=2488065c405ac77cc8ac0397607c9db0a6e8c8ab;hb=f5100665e34b18817e545063b7ca49f79a15b6d6;hp=d1b9cdf4b670c800aa0f08a5cc07d22378ada704;hpb=9328a41f49b22089e85084e6676a764c2573ede1;p=openldap diff --git a/servers/slapd/connection.c b/servers/slapd/connection.c index d1b9cdf4b6..2488065c40 100644 --- a/servers/slapd/connection.c +++ b/servers/slapd/connection.c @@ -1,7 +1,7 @@ /* $OpenLDAP$ */ /* This work is part of OpenLDAP Software . * - * Copyright 1998-2014 The OpenLDAP Foundation. + * Copyright 1998-2015 The OpenLDAP Foundation. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -669,8 +669,6 @@ connection_destroy( Connection *c ) sd = c->c_sd; c->c_sd = AC_SOCKET_INVALID; - c->c_conn_state = SLAP_C_INVALID; - c->c_struct_state = SLAP_C_UNUSED; c->c_close_reason = "?"; /* should never be needed */ sb = c->c_sb; @@ -679,6 +677,8 @@ connection_destroy( Connection *c ) ber_len_t max = sockbuf_max_incoming; ber_sockbuf_ctrl( c->c_sb, LBER_SB_OPT_SET_MAX_INCOMING, &max ); } + c->c_conn_state = SLAP_C_INVALID; + c->c_struct_state = SLAP_C_UNUSED; /* c must be fully reset by this point; when we call slapd_remove * it may get immediately reused by a new connection. @@ -723,6 +723,9 @@ static void connection_abandon( Connection *c ) SlapReply rs = {REP_RESULT}; next = LDAP_STAILQ_NEXT( o, o_next ); + /* don't abandon an op twice */ + if ( o->o_abandon ) + continue; op.orn_msgid = o->o_msgid; o->o_abandon = 1; op.o_bd = frontendDB; @@ -1242,8 +1245,6 @@ void connection_client_stop( assert( c->c_conn_state == SLAP_C_CLIENT ); c->c_listener = NULL; - c->c_conn_state = SLAP_C_INVALID; - c->c_struct_state = SLAP_C_UNUSED; c->c_sd = AC_SOCKET_INVALID; c->c_close_reason = "?"; /* should never be needed */ sb = c->c_sb; @@ -1252,6 +1253,8 @@ void connection_client_stop( ber_len_t max = sockbuf_max_incoming; ber_sockbuf_ctrl( c->c_sb, LBER_SB_OPT_SET_MAX_INCOMING, &max ); } + c->c_conn_state = SLAP_C_INVALID; + c->c_struct_state = SLAP_C_UNUSED; slapd_remove( s, sb, 0, 1, 0 ); connection_return( c );