Skip to content

Commit

Permalink
test: call - reset all cancel rules and cancel only once
Browse files Browse the repository at this point in the history
  • Loading branch information
cspiel1 committed Oct 13, 2023
1 parent 02f4fb4 commit 7bef798
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion test/call.c
Original file line number Diff line number Diff line change
Expand Up @@ -275,6 +275,18 @@ static void cancel_rule_reset(struct cancel_rule *cr)
}


static void cancel_rules_reset(struct fixture *f)
{
struct le *le;

LIST_FOREACH(&f->rules, le) {
struct cancel_rule *cr = le->data;

cancel_rule_reset(cr);
}
}


#define cancel_rule_new(ev, ua, n_incoming, n_progress, n_established) \
cr = fixture_add_cancel_rule(f, ev, ua, n_incoming, n_progress, \
n_established); \
Expand Down Expand Up @@ -310,6 +322,8 @@ static bool check_rule(struct cancel_rule *rule, int met_prev,
if (rule->cr_and) {
met_next = check_rule(rule->cr_and, rule->met && met_prev, ag,
ev, prm);
if (rule->met && met_prev && met_next)
return true;
}

if (rule->met)
Expand Down Expand Up @@ -398,8 +412,9 @@ static bool check_rule(struct cancel_rule *rule, int met_prev,
out:

if (met_prev && met_next) {
info("canceled by %H", cancel_rule_debug, rule);
re_cancel();
cancel_rule_reset(rule);
cancel_rules_reset(ag->fix);
}

return met_next;
Expand Down

0 comments on commit 7bef798

Please sign in to comment.