2 /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
4 * Copyright 1999-2004 The OpenLDAP Foundation.
5 * Portions Copyright 2001-2003 Pierangelo Masarati.
6 * Portions Copyright 1999-2003 Howard Chu.
9 * Redistribution and use in source and binary forms, with or without
10 * modification, are permitted only as authorized by the OpenLDAP
13 * A copy of this license is available in the file LICENSE in the
14 * top-level directory of the distribution or, alternatively, at
15 * <http://www.OpenLDAP.org/license.html>.
18 * This work was initially developed by the Howard Chu for inclusion
19 * in OpenLDAP Software and subsequently enhanced by Pierangelo
27 #include <ac/socket.h>
28 #include <ac/string.h>
31 #include "../back-ldap/back-ldap.h"
32 #include "back-meta.h"
35 meta_back_conn_destroy(
40 struct metainfo *li = ( struct metainfo * )be->be_private;
41 struct metaconn *lc, lc_curr;
44 LDAP_LOG( BACK_META, ENTRY,
45 "meta_back_conn_destroy: fetching conn %ld\n", conn->c_connid, 0, 0 );
46 #else /* !NEW_LOGGING */
47 Debug( LDAP_DEBUG_TRACE,
48 "=>meta_back_conn_destroy: fetching conn %ld\n%s%s",
49 conn->c_connid, "", "" );
50 #endif /* !NEW_LOGGING */
54 ldap_pvt_thread_mutex_lock( &li->conn_mutex );
55 lc = avl_delete( &li->conntree, ( caddr_t )&lc_curr,
57 ldap_pvt_thread_mutex_unlock( &li->conn_mutex );
63 LDAP_LOG( BACK_META, INFO,
64 "meta_back_conn_destroy: destroying conn %ld\n",
65 lc->conn->c_connid, 0, 0 );
66 #else /* !NEW_LOGGING */
67 Debug( LDAP_DEBUG_TRACE,
68 "=>meta_back_conn_destroy: destroying conn %ld\n%s%s",
69 lc->conn->c_connid, "", "" );
70 #endif /* !NEW_LOGGING */
73 * Cleanup rewrite session
75 for ( i = 0; i < li->ntargets; ++i ) {
76 if ( lc->conns[ i ].ld == NULL ) {
80 rewrite_session_delete( li->targets[ i ]->rwmap.rwm_rw, conn );
81 meta_clear_one_candidate( &lc->conns[ i ], 1 );
88 /* no response to unbind */