]> git.sur5r.net Git - openldap/commitdiff
ITS#6850 from Raphael Ouazana @ Linagora
authorHoward Chu <hyc@openldap.org>
Fri, 4 Mar 2011 23:02:23 +0000 (23:02 +0000)
committerHoward Chu <hyc@openldap.org>
Fri, 4 Mar 2011 23:02:23 +0000 (23:02 +0000)
doc/man/man5/slapo-sssvlv.5
servers/slapd/overlays/sssvlv.c

index 73c339b8da8061a9e83d6b725361a16bb0b6e2d7..9bbb6b690e036efac818ae454d16a4073501a38d 100644 (file)
@@ -17,8 +17,8 @@ or globally for all backends.
 Since a complete result set must be generated in memory before sorting can
 be performed, processing sort requests can have a large impact on the
 server's memory use. As such, any connection is limited to having only
-one sort request active at a time. Additional limits may be configured
-as described below.
+a limited number of sorts requests active at a time. Additional limits may
+be configured as described below.
 
 .SH CONFIGURATION
 These
index c853af8a8e765f82bdbe829e80b2f94ca8522148..160ba485bf7997343bbd3176f95aa6a01fcd4ab6 100644 (file)
@@ -341,6 +341,23 @@ static int pack_sss_response_control(
        return rs->sr_err;
 }
 
+/* Return the session id or -1 if unknown */
+static int find_session_by_so(
+       int svi_max_percon,
+       int conn_id,
+       sort_op *so )
+{
+       int sess_id;
+       if (so == NULL) {
+               return -1;
+       }
+       for (sess_id = 0; sess_id < svi_max_percon; sess_id++) {
+               if ( sort_conns[conn_id] && sort_conns[conn_id][sess_id] == so )
+                       return sess_id;
+       }
+       return -1;
+}
+
 /* Return the session id or -1 if unknown */
 static int find_session_by_context(
        int svi_max_percon,
@@ -379,14 +396,13 @@ static int find_next_session(
 static void free_sort_op( Connection *conn, sort_op *so )
 {
        int sess_id;
-       PagedResultsCookie ps_cookie = (PagedResultsCookie) so->so_tree;
        if ( so->so_tree ) {
                tavl_free( so->so_tree, ch_free );
                so->so_tree = NULL;
        }
 
        ldap_pvt_thread_mutex_lock( &sort_conns_mutex );
-       sess_id = find_session_by_context( so->so_info->svi_max_percon, conn->c_conn_idx, so->so_vcontext, ps_cookie );
+       sess_id = find_session_by_so( so->so_info->svi_max_percon, conn->c_conn_idx, so );
        sort_conns[conn->c_conn_idx][sess_id] = NULL;
        so->so_info->svi_num--;
        ldap_pvt_thread_mutex_unlock( &sort_conns_mutex );
@@ -492,7 +508,7 @@ range_err:
                        sc->sc_nkeys * sizeof(struct berval), op->o_tmpmemctx );
                sn->sn_vals = (struct berval *)(sn+1);
                sn->sn_conn = op->o_conn->c_conn_idx;
-               sn->sn_session = find_session_by_context( so->so_info->svi_max_percon, op->o_conn->c_conn_idx, vc->vc_context, NO_PS_COOKIE );
+               sn->sn_session = find_session_by_so( so->so_info->svi_max_percon, op->o_conn->c_conn_idx, so );
                sn->sn_vals[0] = bv;
                for (i=1; i<sc->sc_nkeys; i++) {
                        BER_BVZERO( &sn->sn_vals[i] );
@@ -731,7 +747,7 @@ static int sssvlv_op_response(
                op->o_tmpfree( sn, op->o_tmpmemctx );
                sn = sn2;
                sn->sn_conn = op->o_conn->c_conn_idx;
-               sn->sn_session = find_session_by_context( so->so_info->svi_max_percon, op->o_conn->c_conn_idx, so->so_vcontext, (PagedResultsCookie) so->so_tree );
+               sn->sn_session = find_session_by_so( so->so_info->svi_max_percon, op->o_conn->c_conn_idx, so );
 
                /* Insert into the AVL tree */
                tavl_insert(&(so->so_tree), sn, node_insert, avl_dup_error);