[master] ba34fd3 Put a protocol prefix on enum sess_step.

Poul-Henning Kamp phk at FreeBSD.org
Thu Mar 19 13:06:09 CET 2015


commit ba34fd3a05331fed7ccced94bf67621400881d97
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Thu Mar 19 10:54:30 2015 +0000

    Put a protocol prefix on enum sess_step.
    
    In the future we will need to tell what protocol controls a give
    session, for instance when we come back from the waiter or waiting
    list.   Rather than spend memory on a dedicated field for this,
    protocols will share the enum sess_step, and ranges will be used
    to dispatch to protocols.

diff --git a/bin/varnishd/cache/cache_session.c b/bin/varnishd/cache/cache_session.c
index d0f8fe7..31c2c40 100644
--- a/bin/varnishd/cache/cache_session.c
+++ b/bin/varnishd/cache/cache_session.c
@@ -228,7 +228,7 @@ SES_sess_pool_task(struct worker *wrk, void *arg)
 	req = SES_GetReq(wrk, sp);
 	CHECK_OBJ_NOTNULL(req, REQ_MAGIC);
 
-	sp->sess_step = S_STP_NEWREQ;
+	sp->sess_step = S_STP_H1NEWREQ;
 
 	wrk->task.func = ses_req_pool_task;
 	wrk->task.priv = req;
diff --git a/bin/varnishd/http1/cache_http1_fsm.c b/bin/varnishd/http1/cache_http1_fsm.c
index 4f1614c..a88e4ca 100644
--- a/bin/varnishd/http1/cache_http1_fsm.c
+++ b/bin/varnishd/http1/cache_http1_fsm.c
@@ -347,7 +347,7 @@ HTTP1_Session(struct worker *wrk, struct req *req)
 	 * or waiter, but we'd rather do the syscall in the worker thread.
 	 * On systems which return errors for ioctl, we close early
 	 */
-	if (sp->sess_step == S_STP_NEWREQ && VTCP_blocking(sp->fd)) {
+	if (sp->sess_step == S_STP_H1NEWREQ && VTCP_blocking(sp->fd)) {
 		if (errno == ECONNRESET)
 			SES_Close(sp, SC_REM_CLOSE);
 		else
@@ -370,7 +370,7 @@ HTTP1_Session(struct worker *wrk, struct req *req)
 		return;
 	}
 
-	if (sp->sess_step == S_STP_NEWREQ) {
+	if (sp->sess_step == S_STP_H1NEWREQ) {
 		req->htc->fd = sp->fd;
 		HTTP1_RxInit(req->htc, req->ws,
 		    cache_param->http_req_size, cache_param->http_req_hdr_len);
@@ -378,11 +378,11 @@ HTTP1_Session(struct worker *wrk, struct req *req)
 
 	while (1) {
 		assert(
-		    sp->sess_step == S_STP_NEWREQ ||
+		    sp->sess_step == S_STP_H1NEWREQ ||
 		    req->req_step == R_STP_LOOKUP ||
 		    req->req_step == R_STP_RECV);
 
-		if (sp->sess_step == S_STP_WORKING) {
+		if (sp->sess_step == S_STP_H1WORKING) {
 			if (req->req_step == R_STP_RECV)
 				nxt = http1_dissect(wrk, req);
 			if (nxt == REQ_FSM_MORE)
@@ -395,10 +395,10 @@ HTTP1_Session(struct worker *wrk, struct req *req)
 			case SESS_DONE_RET_GONE:
 				return;
 			case SESS_DONE_RET_WAIT:
-				sp->sess_step = S_STP_NEWREQ;
+				sp->sess_step = S_STP_H1NEWREQ;
 				break;
 			case SESS_DONE_RET_START:
-				sp->sess_step = S_STP_WORKING;
+				sp->sess_step = S_STP_H1WORKING;
 				req->req_step = R_STP_RECV;
 				break;
 			default:
@@ -406,11 +406,11 @@ HTTP1_Session(struct worker *wrk, struct req *req)
 			}
 		}
 
-		if (sp->sess_step == S_STP_NEWREQ) {
+		if (sp->sess_step == S_STP_H1NEWREQ) {
 			nxt = http1_wait(sp, wrk, req);
 			if (nxt != REQ_FSM_MORE)
 				return;
-			sp->sess_step = S_STP_WORKING;
+			sp->sess_step = S_STP_H1WORKING;
 			req->req_step = R_STP_RECV;
 		}
 	}
diff --git a/include/tbl/steps.h b/include/tbl/steps.h
index bb02fb4..534d9a3 100644
--- a/include/tbl/steps.h
+++ b/include/tbl/steps.h
@@ -31,8 +31,8 @@
 /*lint -save -e525 -e539 */
 
 #ifdef SESS_STEP
-SESS_STEP(newreq,	NEWREQ)
-SESS_STEP(working,	WORKING)
+SESS_STEP(h1newreq,	H1NEWREQ)
+SESS_STEP(h1working,	H1WORKING)
 #endif
 
 #ifdef REQ_STEP



More information about the varnish-commit mailing list