Skip to content

Commit

Permalink
http1: Reserve session workspace for the protocol private pointer onl…
Browse files Browse the repository at this point in the history
…y 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).
  • Loading branch information
nigoroll committed Nov 9, 2024
1 parent 41059cf commit e7d41bc
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion bin/varnishd/http1/cache_http1_fsm.c
Original file line number Diff line number Diff line change
Expand Up @@ -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. */
Expand Down

0 comments on commit e7d41bc

Please sign in to comment.