[master] 76da770 Optimistically setup session file descriptor for HTC reception no matter what protocol, a request is quite likely to happen soon-ish.
Poul-Henning Kamp
phk at FreeBSD.org
Mon Mar 23 14:41:47 CET 2015
commit 76da77000c2114f9654942516218629bb948368a
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date: Mon Mar 23 13:37:27 2015 +0000
Optimistically setup session file descriptor for HTC reception no
matter what protocol, a request is quite likely to happen soon-ish.
diff --git a/bin/varnishd/cache/cache.h b/bin/varnishd/cache/cache.h
index 6619c5a..a26a383 100644
--- a/bin/varnishd/cache/cache.h
+++ b/bin/varnishd/cache/cache.h
@@ -982,6 +982,7 @@ int SES_Reschedule_Req(struct req *);
struct req *SES_GetReq(const struct worker *, struct sess *);
void SES_ReleaseReq(struct req *);
task_func_t SES_Proto_Sess;
+task_func_t SES_Proto_Req;
enum htc_status_e {
HTC_S_EMPTY = -3,
diff --git a/bin/varnishd/cache/cache_session.c b/bin/varnishd/cache/cache_session.c
index d7d77a7..2e7f784 100644
--- a/bin/varnishd/cache/cache_session.c
+++ b/bin/varnishd/cache/cache_session.c
@@ -48,6 +48,7 @@
#include "waiter/waiter.h"
#include "vsa.h"
+#include "vtcp.h"
#include "vtim.h"
/*--------------------------------------------------------------------*/
@@ -270,8 +271,8 @@ SES_New(struct sesspool *pp)
* Call protocol for this request
*/
-static void __match_proto__(task_func_t)
-ses_proto_req(struct worker *wrk, void *arg)
+void __match_proto__(task_func_t)
+SES_Proto_Req(struct worker *wrk, void *arg)
{
struct req *req;
@@ -312,15 +313,24 @@ SES_Proto_Sess(struct worker *wrk, void *arg)
CAST_OBJ_NOTNULL(sp, arg, SESS_MAGIC);
WS_Release(sp->ws, 0);
+ /*
+ * Assume we're going to receive something that will likely
+ * involve a request...
+ */
+ (void)VTCP_blocking(sp->fd);
+ req = SES_GetReq(wrk, sp);
+ CHECK_OBJ_NOTNULL(req, REQ_MAGIC);
+ req->htc->fd = sp->fd;
+ SES_RxInit(req->htc, req->ws,
+ cache_param->http_req_size, cache_param->http_req_hdr_len);
+
if (sp->sess_step < S_STP_H1_LAST) {
- req = SES_GetReq(wrk, sp);
- CHECK_OBJ_NOTNULL(req, REQ_MAGIC);
sp->sess_step = S_STP_H1NEWREQ;
- wrk->task.func = ses_proto_req;
+ wrk->task.func = SES_Proto_Req;
wrk->task.priv = req;
} else if (sp->sess_step < S_STP_PROXY_LAST) {
wrk->task.func = VPX_Proto_Sess;
- wrk->task.priv = sp;
+ wrk->task.priv = req;
} else {
WRONG("Wrong session step");
}
@@ -345,7 +355,7 @@ SES_Reschedule_Req(struct req *req)
CHECK_OBJ_NOTNULL(pp, SESSPOOL_MAGIC);
AN(pp->pool);
- req->task.func = ses_proto_req;
+ req->task.func = SES_Proto_Req;
req->task.priv = req;
return (Pool_Task(pp->pool, &req->task, POOL_QUEUE_FRONT));
diff --git a/bin/varnishd/http1/cache_http1_fsm.c b/bin/varnishd/http1/cache_http1_fsm.c
index 698dc79..706f03f 100644
--- a/bin/varnishd/http1/cache_http1_fsm.c
+++ b/bin/varnishd/http1/cache_http1_fsm.c
@@ -373,12 +373,6 @@ HTTP1_Session(struct worker *wrk, struct req *req)
return;
}
- if (sp->sess_step == S_STP_H1NEWREQ) {
- req->htc->fd = sp->fd;
- SES_RxInit(req->htc, req->ws,
- cache_param->http_req_size, cache_param->http_req_hdr_len);
- }
-
while (1) {
assert(
sp->sess_step == S_STP_H1NEWREQ ||
More information about the varnish-commit
mailing list