[master] 07b8a99 Wean V1F_fetch_hdr() of struct vbc which should be and now is an internal matter in cache_backend_*
Poul-Henning Kamp
phk at FreeBSD.org
Tue Jan 13 11:09:29 CET 2015
commit 07b8a996f1cf982fee0072f6fe2374b5c4ede0a4
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date: Tue Jan 13 10:08:49 2015 +0000
Wean V1F_fetch_hdr() of struct vbc which should be and now is an
internal matter in cache_backend_*
diff --git a/bin/varnishd/cache/cache.h b/bin/varnishd/cache/cache.h
index b6d286a..6bbe87d 100644
--- a/bin/varnishd/cache/cache.h
+++ b/bin/varnishd/cache/cache.h
@@ -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;
};
/*--------------------------------------------------------------------*/
diff --git a/bin/varnishd/cache/cache_backend.c b/bin/varnishd/cache/cache_backend.c
index 0debdf1..706ec0b 100644
--- a/bin/varnishd/cache/cache_backend.c
+++ b/bin/varnishd/cache/cache_backend.c
@@ -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++;
diff --git a/bin/varnishd/cache/cache_backend.h b/bin/varnishd/cache/cache_backend.h
index 26cd2c9..dc7c85d 100644
--- a/bin/varnishd/cache/cache_backend.h
+++ b/bin/varnishd/cache/cache_backend.h
@@ -94,10 +94,6 @@ struct vbc {
struct suckaddr *addr;
uint8_t recycled;
-
- /* Timeouts */
- double first_byte_timeout;
- double between_bytes_timeout;
};
/* cache_backend.c */
diff --git a/bin/varnishd/http1/cache_http1_fetch.c b/bin/varnishd/http1/cache_http1_fetch.c
index 1fbb071..15e1bf4 100644
--- a/bin/varnishd/http1/cache_http1_fetch.c
+++ b/bin/varnishd/http1/cache_http1_fetch.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;
More information about the varnish-commit
mailing list