int si_cs_recv(struct conn_stream *cs);
int si_cs_send(struct conn_stream *cs);
struct task *si_cs_io_cb(struct task *t, void *ctx, unsigned short state);
+void si_update_both(struct stream_interface *si_f, struct stream_interface *si_b);
/* returns the channel which receives data from this stream interface (input channel) */
static inline struct channel *si_ic(struct stream_interface *si)
if ((sess->fe->options & PR_O_CONTSTATS) && (s->flags & SF_BE_ASSIGNED))
stream_process_counters(s);
- si_update(si_f);
- si_update(si_b);
+ si_update_both(si_f, si_b);
if (si_f->state == SI_ST_DIS || si_b->state == SI_ST_DIS ||
(((req->flags ^ rqf_last) | (res->flags ^ rpf_last)) & CF_MASK_ANALYSER))
}
}
+/* updates both stream ints of a same stream at once */
+/* Updates at once the channel flags, and timers of both stream interfaces of a
+ * same stream, to complete the work after the analysers, then updates the data
+ * layer below. This will ensure that any synchronous update performed at the
+ * data layer will be reflected in the channel flags and/or stream-interface.
+ */
+void si_update_both(struct stream_interface *si_f, struct stream_interface *si_b)
+{
+ struct channel *req = si_ic(si_f);
+ struct channel *res = si_oc(si_f);
+
+ /* let's recompute both sides states */
+ if (si_f->state == SI_ST_EST)
+ stream_int_update(si_f);
+
+ if (si_b->state == SI_ST_EST)
+ stream_int_update(si_b);
+
+ req->flags &= ~(CF_READ_NULL|CF_READ_PARTIAL|CF_READ_ATTACHED|CF_WRITE_NULL|CF_WRITE_PARTIAL);
+ res->flags &= ~(CF_READ_NULL|CF_READ_PARTIAL|CF_READ_ATTACHED|CF_WRITE_NULL|CF_WRITE_PARTIAL);
+
+ si_f->flags &= ~(SI_FL_ERR|SI_FL_EXP);
+ si_b->flags &= ~(SI_FL_ERR|SI_FL_EXP);
+
+ si_f->prev_state = si_f->state;
+ si_b->prev_state = si_b->state;
+
+ if (si_f->ops->update && si_f->state == SI_ST_EST)
+ si_f->ops->update(si_f);
+
+ if (si_b->ops->update && (si_b->state == SI_ST_EST || si_b->state == SI_ST_CON))
+ si_b->ops->update(si_b);
+}
+
/* Updates the active status of a connection outside of the connection handler
* based on the channel's flags and the stream interface's flags. It needs to
* be called once after the channels' flags have settled down and the stream