int forced = s->flags & SF_RULE_FYIELD;
rule = s->current_rule;
- s->current_rule = NULL;
s->flags &= ~SF_RULE_FYIELD;
if (s->current_rule_list == rules || (def_rules && s->current_rule_list == def_rules)) {
if (forced)
list_for_each_entry(rule, s->current_rule_list, list) {
resume_rule:
+ s->current_rule = rule;
+
/* check if budget is exceeded and we need to continue on the next
* polling loop, unless we know that we cannot yield
*/
if (s->rules_bcount++ >= global.tune.max_rules_at_once && !(act_opts & ACT_OPT_FINAL)) {
- s->current_rule = rule;
s->flags |= SF_RULE_FYIELD;
rule_ret = HTTP_RULE_RES_FYIELD;
task_wakeup(s->task, TASK_WOKEN_MSG);
s->last_entity.ptr = rule;
goto end;
case ACT_RET_YIELD:
- s->current_rule = rule;
if (act_opts & ACT_OPT_FINAL) {
send_log(s->be, LOG_WARNING,
"Internal error: action yields while it is no long allowed "
if (def_rules && s->current_rule_list == def_rules) {
s->current_rule_list = rules;
+ s->current_rule = NULL;
goto restart;
}
end:
/* if the ruleset evaluation is finished reset the strict mode */
- if (rule_ret != HTTP_RULE_RES_YIELD && rule_ret != HTTP_RULE_RES_FYIELD)
+ if (rule_ret != HTTP_RULE_RES_YIELD && rule_ret != HTTP_RULE_RES_FYIELD) {
+ s->current_rule_list = NULL;
+ s->current_rule = NULL;
txn->req.flags &= ~HTTP_MSGF_SOFT_RW;
+ }
/* we reached the end of the rules, nothing to report */
return rule_ret;
int forced = s->flags & SF_RULE_FYIELD;
rule = s->current_rule;
- s->current_rule = NULL;
s->flags &= ~SF_RULE_FYIELD;
if (s->current_rule_list == rules || (def_rules && s->current_rule_list == def_rules)) {
if (forced)
list_for_each_entry(rule, s->current_rule_list, list) {
resume_rule:
+ s->current_rule = rule;
+
/* check if budget is exceeded and we need to continue on the next
* polling loop, unless we know that we cannot yield
*/
if (s->rules_bcount++ >= global.tune.max_rules_at_once && !(act_opts & ACT_OPT_FINAL)) {
- s->current_rule = rule;
s->flags |= SF_RULE_FYIELD;
rule_ret = HTTP_RULE_RES_FYIELD;
task_wakeup(s->task, TASK_WOKEN_MSG);
s->last_entity.ptr = rule;
goto end;
case ACT_RET_YIELD:
- s->current_rule = rule;
if (act_opts & ACT_OPT_FINAL) {
send_log(s->be, LOG_WARNING,
"Internal error: action yields while it is no long allowed "
if (def_rules && s->current_rule_list == def_rules) {
s->current_rule_list = rules;
+ s->current_rule = NULL;
goto restart;
}
end:
/* if the ruleset evaluation is finished reset the strict mode */
- if (rule_ret != HTTP_RULE_RES_YIELD && rule_ret != HTTP_RULE_RES_FYIELD)
+ if (rule_ret != HTTP_RULE_RES_YIELD && rule_ret != HTTP_RULE_RES_FYIELD) {
+ s->current_rule_list = NULL;
+ s->current_rule = NULL;
txn->rsp.flags &= ~HTTP_MSGF_SOFT_RW;
+ }
/* we reached the end of the rules, nothing to report */
return rule_ret;
return ACT_RET_ERR;
/* Finish initialisation of the context. */
- s->current_rule = rule;
if (appctx_init(appctx) == -1)
return ACT_RET_ERR;
- s->current_rule = NULL;
}
else
appctx = __sc_appctx(s->scb);
if (strm->current_rule_list && strm->current_rule) {
const struct act_rule *rule = strm->current_rule;
- chunk_appendf(buf, "%s current_rule=\"%s\" [%s:%d]\n", pfx, rule->kw->kw, rule->conf.file, rule->conf.line);
+ chunk_appendf(buf, "%s current_rule=\"%s\" [%s:%d] (%s)\n",
+ pfx, rule->kw->kw, rule->conf.file, rule->conf.line,
+ (rule == strm->waiting_entity.ptr) ? "YIELDING" : "RUNNING");
}
}
restart:
list_for_each_entry(rule, s->current_rule_list, list) {
resume_rule:
+ s->current_rule = rule;
+
/* check if budget is exceeded and we need to continue on the next
* polling loop, unless we know that we cannot yield
*/
if (s->rules_bcount++ >= global.tune.max_rules_at_once && !(act_opts & ACT_OPT_FINAL)) {
- s->current_rule = rule;
s->flags |= SF_RULE_FYIELD;
task_wakeup(s->task, TASK_WOKEN_MSG);
goto missing_data;
enum acl_test_res ret = ACL_TEST_PASS;
ret = acl_exec_cond(rule->cond, s->be, sess, s, SMP_OPT_DIR_REQ | partial);
- if (ret == ACL_TEST_MISS)
+ if (ret == ACL_TEST_MISS) {
+ s->current_rule = NULL;
goto missing_data;
+ }
ret = acl_pass(ret);
if (rule->cond->pol == ACL_COND_UNLESS)
s->last_entity.ptr = rule;
goto end;
case ACT_RET_YIELD:
- s->current_rule = rule;
if (act_opts & ACT_OPT_FINAL) {
send_log(s->be, LOG_WARNING,
"Internal error: yield not allowed if the inspect-delay expired "
if (def_rules && s->current_rule_list == def_rules) {
s->current_rule_list = rules;
+ s->current_rule = NULL;
goto restart;
}
int forced = s->flags & SF_RULE_FYIELD;
rule = s->current_rule;
- s->current_rule = NULL;
s->flags &= ~SF_RULE_FYIELD;
if (!(rep->flags & SC_FL_ERROR) && !(rep->flags & (CF_READ_TIMEOUT|CF_WRITE_TIMEOUT))) {
s->waiting_entity.type = STRM_ENTITY_NONE;
restart:
list_for_each_entry(rule, s->current_rule_list, list) {
resume_rule:
+ s->current_rule = rule;
+
/* check if budget is exceeded and we need to continue on the next
* polling loop, unless we know that we cannot yield
*/
if (s->rules_bcount++ >= global.tune.max_rules_at_once && !(act_opts & ACT_OPT_FINAL)) {
- s->current_rule = rule;
s->flags |= SF_RULE_FYIELD;
task_wakeup(s->task, TASK_WOKEN_MSG);
goto missing_data;
enum acl_test_res ret = ACL_TEST_PASS;
ret = acl_exec_cond(rule->cond, s->be, sess, s, SMP_OPT_DIR_RES | partial);
- if (ret == ACL_TEST_MISS)
+ if (ret == ACL_TEST_MISS) {
+ s->current_rule = NULL;
goto missing_data;
+ }
ret = acl_pass(ret);
if (rule->cond->pol == ACL_COND_UNLESS)
s->last_entity.ptr = rule;
goto end;
case ACT_RET_YIELD:
- s->current_rule = rule;
if (act_opts & ACT_OPT_FINAL) {
send_log(s->be, LOG_WARNING,
"Internal error: yield not allowed if the inspect-delay expired "
if (def_rules && s->current_rule_list == def_rules) {
s->current_rule_list = rules;
+ s->current_rule = NULL;
goto restart;
}