Commit ba32ab35 authored by Martin Blix Grydeland's avatar Martin Blix Grydeland Committed by Dridi Boukelmoune

Use `timeout_idle` as a timeout for request body

H2 streams waiting for request body data will timeout after timeout_idle
seconds if no new data on the stream is being received. This will ensure
that individual H2 streams can be reaped if there is no data received from
the peer.
parent 63419792
......@@ -31,6 +31,7 @@
#include "cache/cache_varnishd.h"
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
......@@ -955,6 +956,7 @@ h2_vfp_body(struct vfp_ctx *vc, struct vfp_entry *vfe, void *ptr, ssize_t *lp)
uint64_t l, l2, tail;
uint8_t *dst;
char buf[4];
int i;
CHECK_OBJ_NOTNULL(vc, VFP_CTX_MAGIC);
CHECK_OBJ_NOTNULL(vfe, VFP_ENTRY_MAGIC);
......@@ -989,8 +991,12 @@ h2_vfp_body(struct vfp_ctx *vc, struct vfp_entry *vfe, void *ptr, ssize_t *lp)
if (retval != VFP_OK || l > 0)
break;
/* XXX: Timeout */
AZ(Lck_CondWait(r2->cond, &h2->sess->mtx, 0));
i = Lck_CondWait(r2->cond, &h2->sess->mtx,
VTIM_real() + SESS_TMO(h2->sess, timeout_idle));
if (i == ETIMEDOUT) {
retval = VFP_ERROR;
break;
}
}
r2->cond = NULL;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment