Commit 07b8a996 authored by Poul-Henning Kamp's avatar Poul-Henning Kamp

Wean V1F_fetch_hdr() of struct vbc which should be and now is an

internal matter in cache_backend_*
parent a6a74b19
......@@ -242,6 +242,10 @@ struct http_conn {
enum body_status body_status;
struct vfp_ctx vfc[1];
struct vbc *vbc;
/* Timeouts */
double first_byte_timeout;
double between_bytes_timeout;
};
/*--------------------------------------------------------------------*/
......
......@@ -322,8 +322,10 @@ vbe_dir_getfd(const struct director *d, struct busyobj *bo)
INIT_OBJ(bo->htc, HTTP_CONN_MAGIC);
bo->htc->vbc = vc;
bo->htc->fd = vc->fd;
FIND_TMO(first_byte_timeout, vc->first_byte_timeout, bo, vs->vrt);
FIND_TMO(between_bytes_timeout, vc->between_bytes_timeout, bo, vs->vrt);
FIND_TMO(first_byte_timeout,
bo->htc->first_byte_timeout, bo, vs->vrt);
FIND_TMO(between_bytes_timeout,
bo->htc->between_bytes_timeout, bo, vs->vrt);
return (vc->fd);
}
......@@ -400,7 +402,7 @@ vbe_dir_gethdrs(const struct director *d, struct worker *wrk,
* that the backend closed it before we get a request to it.
* Do a single retry in that case.
*/
if (i == 1) {
if (i == 1 && bo->htc->vbc->recycled) {
vbe_dir_finish(d, wrk, bo);
AZ(bo->htc);
VSC_C_main->backend_retry++;
......
......@@ -94,10 +94,6 @@ struct vbc {
struct suckaddr *addr;
uint8_t recycled;
/* Timeouts */
double first_byte_timeout;
double between_bytes_timeout;
};
/* cache_backend.c */
......
......@@ -76,10 +76,9 @@ vbf_iter_req_body(struct req *req, void *priv, void *ptr, size_t l)
int
V1F_fetch_hdr(struct worker *wrk, struct busyobj *bo, const char *def_host)
{
struct vbc *vc;
struct http *hp;
enum http1_status_e hs;
int retry = -1;
int retry = 1;
int i, j, first;
struct http_conn *htc;
int do_chunked = 0;
......@@ -87,14 +86,10 @@ V1F_fetch_hdr(struct worker *wrk, struct busyobj *bo, const char *def_host)
CHECK_OBJ_NOTNULL(wrk, WORKER_MAGIC);
CHECK_OBJ_NOTNULL(bo, BUSYOBJ_MAGIC);
CHECK_OBJ_NOTNULL(bo->htc, HTTP_CONN_MAGIC);
CHECK_OBJ_NOTNULL(bo->htc->vbc, VBC_MAGIC);
CHECK_OBJ_ORNULL(bo->req, REQ_MAGIC);
htc = bo->htc;
hp = bo->bereq;
vc = htc->vbc;
if (vc->recycled)
retry = 1;
/*
* Now that we know our backend, we can set a default Host:
......@@ -154,7 +149,7 @@ V1F_fetch_hdr(struct worker *wrk, struct busyobj *bo, const char *def_host)
CHECK_OBJ_NOTNULL(htc, HTTP_CONN_MAGIC);
CHECK_OBJ_NOTNULL(bo->htc, HTTP_CONN_MAGIC);
VTCP_set_read_timeout(htc->fd, vc->first_byte_timeout);
VTCP_set_read_timeout(htc->fd, htc->first_byte_timeout);
first = 1;
do {
......@@ -180,7 +175,7 @@ V1F_fetch_hdr(struct worker *wrk, struct busyobj *bo, const char *def_host)
retry = -1;
first = 0;
VTCP_set_read_timeout(htc->fd,
vc->between_bytes_timeout);
htc->between_bytes_timeout);
}
} while (hs != HTTP1_COMPLETE);
bo->acct.beresp_hdrbytes += htc->rxbuf_e - htc->rxbuf_b;
......
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