[master] d533839 Collapse SES_RxReInit() into SES_RxInit().
Poul-Henning Kamp
phk at FreeBSD.org
Tue Apr 5 22:12:04 CEST 2016
commit d533839d31835a7dfa43bdccd1ca1cfbbf72c726
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date: Tue Apr 5 19:48:05 2016 +0000
Collapse SES_RxReInit() into SES_RxInit().
diff --git a/bin/varnishd/cache/cache.h b/bin/varnishd/cache/cache.h
index ee024c5..7df18fd 100644
--- a/bin/varnishd/cache/cache.h
+++ b/bin/varnishd/cache/cache.h
@@ -962,7 +962,6 @@ enum htc_status_e {
};
void SES_RxInit(struct http_conn *htc, struct ws *ws);
-void SES_RxReInit(struct http_conn *htc);
enum htc_status_e SES_RxStuff(struct http_conn *, htc_complete_f *,
double *t1, double *t2, double ti, double tn, int maxbytes);
diff --git a/bin/varnishd/cache/cache_acceptor.c b/bin/varnishd/cache/cache_acceptor.c
index faeaeb8..9f3a341 100644
--- a/bin/varnishd/cache/cache_acceptor.c
+++ b/bin/varnishd/cache/cache_acceptor.c
@@ -376,7 +376,6 @@ vca_make_session(struct worker *wrk, void *arg)
req = Req_New(wrk, sp);
CHECK_OBJ_NOTNULL(req, REQ_MAGIC);
req->htc->fd = sp->fd;
- SES_RxInit(req->htc, req->ws);
SES_SetTransport(wrk, sp, req, wa->acceptlsock->transport);
}
diff --git a/bin/varnishd/cache/cache_req.c b/bin/varnishd/cache/cache_req.c
index f4e4f61..63be280 100644
--- a/bin/varnishd/cache/cache_req.c
+++ b/bin/varnishd/cache/cache_req.c
@@ -66,6 +66,8 @@ Req_New(const struct worker *wrk, struct sess *sp)
req->sp = sp;
req->top = req; // esi overrides
+ INIT_OBJ(req->htc, HTTP_CONN_MAGIC);
+
e = (char*)req + sz;
p = (char*)(req + 1);
p = (void*)PRNDUP(p);
diff --git a/bin/varnishd/cache/cache_session.c b/bin/varnishd/cache/cache_session.c
index c9c7fa7..52682aa 100644
--- a/bin/varnishd/cache/cache_session.c
+++ b/bin/varnishd/cache/cache_session.c
@@ -185,33 +185,13 @@ SES_Get_String_Attr(const struct sess *sp, enum sess_attr a)
void
SES_RxInit(struct http_conn *htc, struct ws *ws)
{
+ ssize_t l;
- htc->magic = HTTP_CONN_MAGIC;
+ CHECK_OBJ_NOTNULL(htc, HTTP_CONN_MAGIC);
htc->ws = ws;
-
(void)WS_Reserve(htc->ws, 0);
htc->rxbuf_b = ws->f;
htc->rxbuf_e = ws->f;
- *htc->rxbuf_e = '\0';
- htc->pipeline_b = NULL;
- htc->pipeline_e = NULL;
-}
-
-/*--------------------------------------------------------------------
- * Start over, and recycle any pipelined input.
- * The WS_Reset is safe, even though the pipelined input is stored in
- * the ws somewhere, because WS_Reset only fiddles pointers.
- */
-
-void
-SES_RxReInit(struct http_conn *htc)
-{
- ssize_t l;
-
- CHECK_OBJ_NOTNULL(htc, HTTP_CONN_MAGIC);
- (void)WS_Reserve(htc->ws, 0);
- htc->rxbuf_b = htc->ws->f;
- htc->rxbuf_e = htc->ws->f;
if (htc->pipeline_b != NULL) {
l = htc->pipeline_e - htc->pipeline_b;
assert(l > 0);
diff --git a/bin/varnishd/http1/cache_http1_fsm.c b/bin/varnishd/http1/cache_http1_fsm.c
index ba937d2..220dfd0 100644
--- a/bin/varnishd/http1/cache_http1_fsm.c
+++ b/bin/varnishd/http1/cache_http1_fsm.c
@@ -112,6 +112,7 @@ http1_new_session(struct worker *wrk, void *arg)
sp = req->sp;
CHECK_OBJ_NOTNULL(sp, SESS_MAGIC);
+ SES_RxInit(req->htc, req->ws);
SES_Reserve_xport_priv(sp, &u);
http1_setstate(sp, H1NEWREQ);
wrk->task.func = http1_req;
@@ -394,7 +395,7 @@ HTTP1_Session(struct worker *wrk, struct req *req)
} else if (st == H1CLEANUP) {
if (Req_Cleanup(sp, wrk, req))
return;
- SES_RxReInit(req->htc);
+ SES_RxInit(req->htc, req->ws);
if (req->htc->rxbuf_e != req->htc->rxbuf_b)
wrk->stats->sess_readahead++;
http1_setstate(sp, H1NEWREQ);
diff --git a/bin/varnishd/proxy/cache_proxy_proto.c b/bin/varnishd/proxy/cache_proxy_proto.c
index 3c9cffe..9d584ee 100644
--- a/bin/varnishd/proxy/cache_proxy_proto.c
+++ b/bin/varnishd/proxy/cache_proxy_proto.c
@@ -350,6 +350,7 @@ vpx_new_session(struct worker *wrk, void *arg)
assert(sizeof vpx1_sig == 5);
assert(sizeof vpx2_sig == 12);
+ SES_RxInit(req->htc, req->ws);
hs = SES_RxStuff(req->htc, vpx_complete,
NULL, NULL, NAN, sp->t_idle + cache_param->timeout_idle,
1024); // XXX ?
@@ -376,7 +377,6 @@ vpx_new_session(struct worker *wrk, void *arg)
req->htc->pipeline_b = NULL;
else
req->htc->pipeline_e = req->htc->rxbuf_e;
- SES_RxReInit(req->htc);
SES_SetTransport(wrk, sp, req, &HTTP1_transport);
}
More information about the varnish-commit
mailing list