[master] a6a74b1 Rename HTTP_Init() to the more precise HTTP_RxInit() and relieve it of the job of setting htc->fd.

Poul-Henning Kamp phk at FreeBSD.org
Tue Jan 13 10:54:29 CET 2015


commit a6a74b19bef0b75d5769da12418e42c7b5f3c0b4
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Tue Jan 13 09:53:46 2015 +0000

    Rename HTTP_Init() to the more precise HTTP_RxInit() and relieve it
    of the job of setting htc->fd.

diff --git a/bin/varnishd/cache/cache.h b/bin/varnishd/cache/cache.h
index 5c9955e..b6d286a 100644
--- a/bin/varnishd/cache/cache.h
+++ b/bin/varnishd/cache/cache.h
@@ -864,7 +864,7 @@ enum http1_status_e {
 	HTTP1_COMPLETE =	 1
 };
 
-void HTTP1_Init(struct http_conn *htc, struct ws *ws, int fd,
+void HTTP1_RxInit(struct http_conn *htc, struct ws *ws,
     unsigned maxbytes, unsigned maxhdr);
 enum http1_status_e HTTP1_Reinit(struct http_conn *htc);
 enum http1_status_e HTTP1_Rx(struct http_conn *htc);
diff --git a/bin/varnishd/cache/cache_backend.c b/bin/varnishd/cache/cache_backend.c
index 8f12e91..0debdf1 100644
--- a/bin/varnishd/cache/cache_backend.c
+++ b/bin/varnishd/cache/cache_backend.c
@@ -321,6 +321,7 @@ vbe_dir_getfd(const struct director *d, struct busyobj *bo)
 	AN(bo->htc);
 	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);
 	return (vc->fd);
diff --git a/bin/varnishd/http1/cache_http1_fetch.c b/bin/varnishd/http1/cache_http1_fetch.c
index bb40205..1fbb071 100644
--- a/bin/varnishd/http1/cache_http1_fetch.c
+++ b/bin/varnishd/http1/cache_http1_fetch.c
@@ -110,8 +110,8 @@ V1F_fetch_hdr(struct worker *wrk, struct busyobj *bo, const char *def_host)
 		do_chunked = 1;
 	}
 
-	(void)VTCP_blocking(vc->fd);	/* XXX: we should timeout instead */
-	V1L_Reserve(wrk, wrk->aws, &vc->fd, bo->vsl, bo->t_prev);
+	(void)VTCP_blocking(htc->fd);	/* XXX: we should timeout instead */
+	V1L_Reserve(wrk, wrk->aws, &htc->fd, bo->vsl, bo->t_prev);
 	bo->acct.bereq_hdrbytes = HTTP1_Write(wrk, hp, HTTP1_Req);
 
 	/* Deal with any message-body the request might (still) have */
@@ -149,12 +149,12 @@ V1F_fetch_hdr(struct worker *wrk, struct busyobj *bo, const char *def_host)
 
 	/* Receive response */
 
-	HTTP1_Init(htc, bo->ws, vc->fd, cache_param->http_resp_size,
+	HTTP1_RxInit(htc, bo->ws, cache_param->http_resp_size,
 	    cache_param->http_resp_hdr_len);
 	CHECK_OBJ_NOTNULL(htc, HTTP_CONN_MAGIC);
 	CHECK_OBJ_NOTNULL(bo->htc, HTTP_CONN_MAGIC);
 
-	VTCP_set_read_timeout(vc->fd, vc->first_byte_timeout);
+	VTCP_set_read_timeout(htc->fd, vc->first_byte_timeout);
 
 	first = 1;
 	do {
@@ -179,7 +179,7 @@ V1F_fetch_hdr(struct worker *wrk, struct busyobj *bo, const char *def_host)
 		if (first) {
 			retry = -1;
 			first = 0;
-			VTCP_set_read_timeout(vc->fd,
+			VTCP_set_read_timeout(htc->fd,
 			    vc->between_bytes_timeout);
 		}
 	} while (hs != HTTP1_COMPLETE);
diff --git a/bin/varnishd/http1/cache_http1_fsm.c b/bin/varnishd/http1/cache_http1_fsm.c
index c1e98d4..5747b6a 100644
--- a/bin/varnishd/http1/cache_http1_fsm.c
+++ b/bin/varnishd/http1/cache_http1_fsm.c
@@ -368,7 +368,8 @@ HTTP1_Session(struct worker *wrk, struct req *req)
 	}
 
 	if (sp->sess_step == S_STP_NEWREQ) {
-		HTTP1_Init(req->htc, req->ws, sp->fd,
+		req->htc->fd = sp->fd;
+		HTTP1_RxInit(req->htc, req->ws,
 		    cache_param->http_req_size, cache_param->http_req_hdr_len);
 	}
 
diff --git a/bin/varnishd/http1/cache_http1_proto.c b/bin/varnishd/http1/cache_http1_proto.c
index 45f4784..ca013c6 100644
--- a/bin/varnishd/http1/cache_http1_proto.c
+++ b/bin/varnishd/http1/cache_http1_proto.c
@@ -60,13 +60,12 @@ const int HTTP1_Resp[3] = {
 /*--------------------------------------------------------------------*/
 
 void
-HTTP1_Init(struct http_conn *htc, struct ws *ws, int fd, unsigned maxbytes,
+HTTP1_RxInit(struct http_conn *htc, struct ws *ws, unsigned maxbytes,
     unsigned maxhdr)
 {
 
 	htc->magic = HTTP_CONN_MAGIC;
 	htc->ws = ws;
-	htc->fd = fd;
 	htc->maxbytes = maxbytes;
 	htc->maxhdr = maxhdr;
 



More information about the varnish-commit mailing list