Commit 43bbe97b authored by Nils Goroll's avatar Nils Goroll

Pull the deadline calculation out of V1L

and change the t0 argument into a vtim_real deadline, allowing for
adjustments per call.

This causes changes of send_timeout to not change open V1L transactions.

This also exposed the fact that we are using send_timeout also for
sending the bereq.body to the backend. Is this what we want?
parent 8e540d38
......@@ -59,7 +59,7 @@ void V1P_Charge(struct req *, const struct v1p_acct *, struct VSC_vbe *);
void V1L_Chunked(const struct worker *w);
void V1L_EndChunk(const struct worker *w);
void V1L_Open(struct worker *, struct ws *, int *fd, struct vsl_log *,
double t0, unsigned niov);
vtim_real deadline, unsigned niov);
unsigned V1L_Flush(const struct worker *w);
unsigned V1L_Close(struct worker *w, uint64_t *cnt);
size_t V1L_Write(const struct worker *w, const void *ptr, ssize_t len);
......@@ -131,7 +131,8 @@ V1D_Deliver(struct req *req, struct boc *boc, int sendbody)
AZ(req->wrk->v1l);
V1L_Open(req->wrk, req->wrk->aws,
&req->sp->fd, req->vsl, req->t_prev, cache_param->http1_iovs);
&req->sp->fd, req->vsl, req->t_prev + cache_param->send_timeout,
cache_param->http1_iovs);
if (WS_Overflowed(req->wrk->aws)) {
v1d_error(req, "workspace_thread overflow");
......
......@@ -96,7 +96,9 @@ V1F_SendReq(struct worker *wrk, struct busyobj *bo, uint64_t *ctr_hdrbytes,
}
VTCP_blocking(*htc->rfd); /* XXX: we should timeout instead */
V1L_Open(wrk, wrk->aws, htc->rfd, bo->vsl, bo->t_prev, 0);
/* XXX: what is the right timeout ? Isn't send_timeout client side? */
V1L_Open(wrk, wrk->aws, htc->rfd, bo->vsl,
bo->t_prev + cache_param->send_timeout, 0);
hdrbytes = HTTP1_Write(wrk, hp, HTTP1_Req);
/* Deal with any message-body the request might (still) have */
......
......@@ -60,7 +60,7 @@ struct v1l {
ssize_t liov;
ssize_t cliov;
unsigned ciov; /* Chunked header marker */
double t0;
vtim_real deadline;
struct vsl_log *vsl;
ssize_t cnt; /* Flushed byte count */
struct ws *ws;
......@@ -74,7 +74,7 @@ struct v1l {
void
V1L_Open(struct worker *wrk, struct ws *ws, int *fd, struct vsl_log *vsl,
double t0, unsigned niov)
vtim_real deadline, unsigned niov)
{
struct v1l *v1l;
unsigned u;
......@@ -114,7 +114,7 @@ V1L_Open(struct worker *wrk, struct ws *ws, int *fd, struct vsl_log *vsl,
v1l->siov = u;
v1l->ciov = u;
v1l->wfd = fd;
v1l->t0 = t0;
v1l->deadline = deadline;
v1l->vsl = vsl;
wrk->v1l = v1l;
......@@ -209,7 +209,7 @@ V1L_Flush(const struct worker *wrk)
* counter to prevent slowloris attacks
*/
if (VTIM_real() - v1l->t0 > cache_param->send_timeout) {
if (VTIM_real() > v1l->deadline) {
VSLb(v1l->vsl, SLT_Debug,
"Hit total send timeout, "
"wrote = %zd/%zd; not retrying",
......
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