[master] c3b64c8a6 http1: Reserve session workspace for the protocol private pointer only once
Nils Goroll
nils.goroll at uplex.de
Mon Nov 18 14:41:03 UTC 2024
commit c3b64c8a6f35182133416a0971ef2955e862b887
Author: Nils Goroll <nils.goroll at uplex.de>
Date: Tue Nov 5 20:29:02 2024 +0100
http1: Reserve session workspace for the protocol private pointer only once
This allows to re-use http1_new_session from custom implementations, in that it
can serve as an entry point into the state machine also for existing sessions
(without requiting 8 bytes of session workspace for each request served).
diff --git a/bin/varnishd/http1/cache_http1_fsm.c b/bin/varnishd/http1/cache_http1_fsm.c
index cc3420362..ed60f5d5b 100644
--- a/bin/varnishd/http1/cache_http1_fsm.c
+++ b/bin/varnishd/http1/cache_http1_fsm.c
@@ -114,7 +114,10 @@ http1_new_session(struct worker *wrk, void *arg)
CHECK_OBJ_NOTNULL(sp, SESS_MAGIC);
HTC_RxInit(req->htc, req->ws);
- if (!SES_Reserve_proto_priv(sp, &u, &sz)) {
+
+ sz = sizeof u;
+ if (SES_Get_proto_priv(sp, &u) &&
+ !SES_Reserve_proto_priv(sp, &u, &sz)) {
/* Out of session workspace. Free the req, close the sess,
* and do not set a new task func, which will exit the
* worker thread. */
More information about the varnish-commit
mailing list