]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MEDIUM: streams: Store prev_state before calling si_update_both().
authorOlivier Houchard <ohouchard@haproxy.com>
Tue, 9 Apr 2019 17:14:59 +0000 (19:14 +0200)
committerOlivier Houchard <cognet@ci0.org>
Tue, 9 Apr 2019 17:31:22 +0000 (19:31 +0200)
As si_update_both() sets prev_state to state for each stream_interface, if
we want to check it changed, copy it before calling si_update_both().

This should be backported to 1.9.

src/stream.c

index e19056e21c7cf0e59fea73f14c719e200038322e..70e98b83ccab2e49d336712fe4cf5d24f3a1e1b7 100644 (file)
@@ -2488,14 +2488,18 @@ redo:
 
        if (likely((si_f->state != SI_ST_CLO) ||
                   (si_b->state > SI_ST_INI && si_b->state < SI_ST_CLO))) {
+               enum si_state si_b_prev_state, si_f_prev_state;
+
+               si_f_prev_state = si_f->prev_state;
+               si_b_prev_state = si_b->prev_state;
 
                if ((sess->fe->options & PR_O_CONTSTATS) && (s->flags & SF_BE_ASSIGNED))
                        stream_process_counters(s);
 
                si_update_both(si_f, si_b);
 
-               if (si_f->state == SI_ST_DIS || si_f->state != si_f->prev_state ||
-                   si_b->state == SI_ST_DIS || si_b->state != si_b->prev_state ||
+               if (si_f->state == SI_ST_DIS || si_f->state != si_f_prev_state ||
+                   si_b->state == SI_ST_DIS || si_b->state != si_b_prev_state ||
                    ((si_f->flags | si_b->flags) & SI_FL_ERR) ||
                    (((req->flags ^ rqf_last) | (res->flags ^ rpf_last)) & CF_MASK_ANALYSER))
                        goto redo;