Home | History | Annotate | Download | only in back-asyncmeta

Lines Matching refs:bc

42 asyncmeta_send_ldap_result(bm_context_t *bc, Operation *op, SlapReply *rs)
44 if (bc->c_peer_name.bv_val == op->o_conn->c_peer_name.bv_val && !bc->op->o_abandon ) {
45 send_ldap_result(&bc->copy_op, rs);
46 bc->op->o_callback = bc->copy_op.o_callback;
47 bc->op->o_extra = bc->copy_op.o_extra;
48 bc->op->o_ctrls = bc->copy_op.o_ctrls;
53 asyncmeta_is_last_result(a_metaconn_t *mc, bm_context_t *bc, int candidate)
57 SlapReply *candidates = bc->candidates;
494 asyncmeta_search_last_result(a_metaconn_t *mc, bm_context_t *bc, int candidate, int sres)
497 Operation *op = bc->op;
498 SlapReply *rs = &bc->rs;
500 SlapReply *candidates = bc->candidates;
503 if ( bc->candidate_match > 0 ) {
600 asyncmeta_send_ldap_result(bc, op, rs);
607 asyncmeta_send_pending_op(bm_context_t *bc, int candidate)
610 switch (bc->op->o_tag) {
612 retcode = asyncmeta_back_search_start( &bc->copy_op, &bc->rs, bc->bc_mc, bc, candidate, NULL, 0 , 0);
615 retcode = asyncmeta_back_add_start( &bc->copy_op, &bc->rs, bc->bc_mc, bc, candidate, 0);
618 retcode = asyncmeta_back_modify_start( &bc->copy_op, &bc->rs, bc->bc_mc, bc, candidate, 0);
621 retcode = asyncmeta_back_modrdn_start( &bc->copy_op, &bc->rs, bc->bc_mc, bc, candidate, 0);
624 retcode = asyncmeta_back_compare_start( &bc->copy_op, &bc->rs, bc->bc_mc, bc, candidate, 0);
627 retcode = asyncmeta_back_delete_start( &bc->copy_op, &bc->rs, bc->bc_mc, bc, candidate, 0);
640 bm_context_t *bc, *onext;
647 for (bc = LDAP_STAILQ_FIRST(&mc->mc_om_list); bc; bc = onext) {
649 onext = LDAP_STAILQ_NEXT(bc, bc_next);
650 if (bc->candidates[candidate].sr_msgid == META_MSGID_NEED_BIND)
651 bc->candidates[candidate].sr_msgid = META_MSGID_GOT_BIND;
652 if (bc->candidates[candidate].sr_msgid != META_MSGID_GOT_BIND || bc->bc_active > 0 || bc->op->o_abandon > 0) {
655 bc->op->o_threadctx = ctx;
656 bc->op->o_tid = ldap_pvt_thread_pool_tid( ctx );
657 slap_sl_mem_setctx(ctx, bc->op->o_tmpmemctx);
658 operation_counter_init( bc->op, ctx );
659 bc->bc_active++;
660 ret = asyncmeta_send_pending_op(bc, candidate);
662 bc->candidates[ candidate ].sr_msgid = META_MSGID_IGNORE;
663 bc->candidates[ candidate ].sr_type = REP_RESULT;
664 bc->candidates[ candidate ].sr_err = bc->rs.sr_err;
665 if (bc->op->o_tag != LDAP_REQ_SEARCH || (META_BACK_ONERR_STOP( mi )) ||
666 (asyncmeta_is_last_result(mc, bc, candidate) == 0)) {
667 LDAP_STAILQ_REMOVE(&mc->mc_om_list, bc, bm_context_t, bc_next);
669 asyncmeta_send_ldap_result(bc, bc->op, &bc->rs);
670 asyncmeta_clear_bm_context(bc);
673 bc->bc_active--;
688 bm_context_t *bc, *onext;
693 for (bc = LDAP_STAILQ_FIRST(&mc->mc_om_list); bc; bc = onext) {
694 onext = LDAP_STAILQ_NEXT(bc, bc_next);
695 if (bc->candidates[candidate].sr_msgid != META_MSGID_NEED_BIND
696 || bc->bc_active > 0 || bc->op->o_abandon > 0) {
699 bc->candidates[ candidate ].sr_msgid = META_MSGID_IGNORE;
700 bc->candidates[ candidate ].sr_type = REP_RESULT;
701 bc->candidates[ candidate ].sr_err = bind_result->sr_err;
702 if (bc->op->o_tag != LDAP_REQ_SEARCH || (META_BACK_ONERR_STOP( mi )) ||
703 (asyncmeta_is_last_result(mc, bc, candidate) == 0)) {
704 LDAP_STAILQ_REMOVE(&mc->mc_om_list, bc, bm_context_t, bc_next);
705 bc->op->o_threadctx = ctx;
706 bc->op->o_tid = ldap_pvt_thread_pool_tid( ctx );
707 slap_sl_mem_setctx(ctx, bc->op->o_tmpmemctx);
708 operation_counter_init( bc->op, ctx );
709 bc->rs.sr_err = bind_result->sr_err;
710 bc->rs.sr_text = bind_result->sr_text;
712 asyncmeta_send_ldap_result(bc, bc->op, &bc->rs);
713 asyncmeta_clear_bm_context(bc);
742 asyncmeta_handle_search_msg(LDAPMessage *res, a_metaconn_t *mc, bm_context_t *bc, int candidate)
747 Operation *op = bc->op;
757 rs = &bc->rs;
767 candidates = bc->candidates;
783 if (bc->c_peer_name.bv_val == op->o_conn->c_peer_name.bv_val && !op->o_abandon) {
784 rs->sr_err = asyncmeta_send_entry( &bc->copy_op, rs, mc, i, msg );
790 asyncmeta_send_ldap_result(bc, op, rs);
799 bc->is_ok++;
805 asyncmeta_send_ldap_result(bc, op, rs);
812 bc->is_ok++;
818 asyncmeta_send_ldap_result(bc, op, rs);
870 bc->is_ok++;
883 asyncmeta_send_ldap_result(bc, op, rs);
958 bc->candidate_match++;
1045 if ( bc->is_ok ) {
1096 switch ( asyncmeta_back_search_start( &bc->copy_op, rs, mc, bc, i, &prcookie, prsize, 1 ) )
1109 asyncmeta_send_ldap_result(bc, op, rs);
1137 bc->is_ok++;
1157 asyncmeta_send_ldap_result(bc, op, rs);
1177 if (asyncmeta_is_last_result(mc, bc, i) == 0) {
1181 asyncmeta_search_last_result(mc, bc, i, sres);
1185 asyncmeta_drop_bc( mc, bc);
1186 asyncmeta_clear_bm_context(bc);
1209 bc->bc_active--;
1217 int asyncmeta_handle_common_result(LDAPMessage *msg, a_metaconn_t *mc, bm_context_t *bc, int candidate)
1240 op = bc->op;
1241 rs = &bc->rs;
1346 asyncmeta_drop_bc( mc, bc);
1350 asyncmeta_send_ldap_result(bc, op, rs);
1377 asyncmeta_clear_bm_context(bc);
1387 bm_context_t *bc, *onext;
1411 for (bc = LDAP_STAILQ_FIRST(&mc->mc_om_list); bc; bc = onext) {
1412 onext = LDAP_STAILQ_NEXT(bc, bc_next);
1414 candidates = bc->candidates;
1419 if (bc->op->o_abandon) {
1420 bc->bc_invalid = 1;
1424 if (bc->bc_active > 0) {
1425 bc->bc_invalid = 1;
1429 bc->op->o_threadctx = ctx;
1430 bc->op->o_tid = ldap_pvt_thread_pool_tid( ctx );
1431 slap_sl_mem_setctx(ctx, bc->op->o_tmpmemctx);
1432 operation_counter_init( bc->op, ctx );
1434 op = bc->op;
1435 rs = &bc->rs;
1444 asyncmeta_send_ldap_result( bc, op, rs );
1455 asyncmeta_is_last_result(mc, bc, candidate)) && op->o_conn) {
1456 asyncmeta_send_ldap_result( bc, op, rs );
1469 if (j != candidate && bc->candidates[j].sr_msgid >= 0
1472 bc->candidates[ j ].sr_msgid, j );
1475 LDAP_STAILQ_REMOVE(&mc->mc_om_list, bc, bm_context_t, bc_next);
1477 asyncmeta_clear_bm_context(bc);
1492 bm_context_t *bc;
1559 bc = asyncmeta_find_message(ldap_msgid(msg), mc, i);
1562 if (bc && bc->bc_active > 0) {
1567 if (bc) {
1568 bc->bc_active++;
1574 if (!bc) {
1576 "asyncmeta_op_handle_result: Unable to find bc for msguid %d, msc: %p\n", ldap_msgid(msg), msc );
1582 bc->op->o_threadctx = ctx;
1583 bc->op->o_tid = ldap_pvt_thread_pool_tid( ctx );
1584 slap_sl_mem_setctx(ctx, bc->op->o_tmpmemctx);
1585 operation_counter_init( bc->op, ctx );
1586 if (bc->op->o_abandon) {
1588 asyncmeta_drop_bc( mc, bc);
1589 if ( bc->op->o_tag == LDAP_REQ_SEARCH ) {
1592 if (bc->candidates[j].sr_msgid >= 0) {
1595 asyncmeta_back_cancel( mc, bc->op,
1596 bc->candidates[ j ].sr_msgid, j );
1601 asyncmeta_clear_bm_context(bc);
1613 asyncmeta_handle_search_msg(msg, mc, bc, i);
1622 rc = asyncmeta_handle_common_result(msg, mc, bc, i);
1667 bm_context_t *bc, *onext;
1686 for (bc = LDAP_STAILQ_FIRST(&mc->mc_om_list); bc; bc = onext) {
1687 onext = LDAP_STAILQ_NEXT(bc, bc_next);
1688 if (bc->bc_active > 0) {
1693 bc->bc_invalid = 1;
1696 if (bc->op->o_abandon ) {
1697 Operation *op = bc->op;
1705 LDAP_STAILQ_REMOVE(&mc->mc_om_list, bc, bm_context_t, bc_next);
1708 if (bc->candidates[j].sr_msgid >= 0) {
1713 bc->candidates[ j ].sr_msgid, j );
1718 asyncmeta_clear_bm_context(bc);
1721 if (bc->bc_invalid) {
1722 LDAP_STAILQ_REMOVE(&mc->mc_om_list, bc, bm_context_t, bc_next);
1724 LDAP_STAILQ_INSERT_TAIL( &timeout_list, bc, bc_next);
1728 if (bc->timeout && bc->stoptime < current_time) {
1729 Operation *op = bc->op;
1730 LDAP_STAILQ_REMOVE(&mc->mc_om_list, bc, bm_context_t, bc_next);
1732 LDAP_STAILQ_INSERT_TAIL( &timeout_list, bc, bc_next);
1734 if (bc->candidates[j].sr_msgid >= 0) {
1740 bc->candidates[ j ].sr_msgid, j );
1749 for (bc = LDAP_STAILQ_FIRST(&timeout_list); bc; bc = onext) {
1750 Operation *op = bc->op;
1751 SlapReply *rs = &bc->rs;
1755 onext = LDAP_STAILQ_NEXT(bc, bc_next);
1756 LDAP_STAILQ_REMOVE(&timeout_list, bc, bm_context_t, bc_next);
1758 bc->op->o_threadctx = ctx;
1759 bc->op->o_tid = ldap_pvt_thread_pool_tid( ctx );
1760 slap_sl_mem_setctx(ctx, bc->op->o_tmpmemctx);
1761 operation_counter_init( bc->op, ctx );
1763 if (bc->searchtime) {
1770 if ( bc->bc_invalid ) {
1778 bc->op->o_log_prefix, rtask, current_time, bc->op->o_time,
1781 if (bc->searchtime) {
1788 if (bc->candidates[j].sr_msgid >= 0) {
1791 bc->candidates[j].sr_type == REP_RESULT) {
1812 if (!bc->op->o_abandon ) {
1813 asyncmeta_send_ldap_result( bc, bc->op, &bc->rs );
1815 asyncmeta_clear_bm_context(bc);