chn->to_forward = CHN_INFINITE_FORWARD;
}
+/* <len> bytes of input data was added into the channel <chn>. This functions
+ * must be called to update the channel state. It also handles the fast
+ * forwarding. */
+static inline void channel_add_input(struct channel *chn, unsigned int len)
+{
+ if (chn->to_forward) {
+ unsigned long fwd = len;
+ if (chn->to_forward != CHN_INFINITE_FORWARD) {
+ if (fwd > chn->to_forward)
+ fwd = chn->to_forward;
+ chn->to_forward -= fwd;
+ }
+ c_adv(chn, fwd);
+ }
+ /* notify that some data was read */
+ chn->total += len;
+ chn->flags |= CF_READ_PARTIAL;
+}
+
static inline unsigned long long channel_htx_forward(struct channel *chn, struct htx *htx, unsigned long long bytes)
{
unsigned long long ret;
channel_forward_forever(chn);
b_set_data(&chn->buf, b_size(&chn->buf));
}
-
/*********************************************************************/
/* These functions are used to compute various channel content sizes */
/*********************************************************************/
memcpy(c_orig(chn), blk + max, len - max);
b_add(&chn->buf, len);
- chn->total += len;
- if (chn->to_forward) {
- unsigned long fwd = len;
- if (chn->to_forward != CHN_INFINITE_FORWARD) {
- if (fwd > chn->to_forward)
- fwd = chn->to_forward;
- chn->to_forward -= fwd;
- }
- c_adv(chn, fwd);
- }
-
- /* notify that some data was read from the SI into the buffer */
- chn->flags |= CF_READ_PARTIAL;
+ channel_add_input(chn, len);
return len;
}