Skip to content

Commit

Permalink
Simplify initialization of the H2 VDP
Browse files Browse the repository at this point in the history
Initialize the private pointer directly, instead of indirectly via
the request struct.
  • Loading branch information
nigoroll committed Dec 27, 2023
1 parent 8d0b37d commit 610d177
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions bin/varnishd/http2/cache_http2_deliver.c
Original file line number Diff line number Diff line change
Expand Up @@ -75,12 +75,14 @@ V2D_Init(void)
static int v_matchproto_(vdp_init_f)
h2_init(VRT_CTX, struct vdp_ctx *vdc, void **priv, struct objcore *oc)
{
struct h2_req *r2;

CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC);
CHECK_OBJ_NOTNULL(vdc, VDP_CTX_MAGIC);
AN(priv);
CAST_OBJ_NOTNULL(r2, *priv, H2_REQ_MAGIC);
(void)r2;
(void)oc;
CHECK_OBJ_NOTNULL(vdc->req, REQ_MAGIC);
*priv = vdc->req->transport_priv;
return (0);
}

Expand Down Expand Up @@ -346,7 +348,7 @@ h2_deliver(struct req *req, struct boc *boc, int sendbody)
if (sendbody) {
INIT_OBJ(ctx, VRT_CTX_MAGIC);
VCL_Req2Ctx(ctx, req);
if (!VDP_Push(ctx, req->vdc, req->ws, &h2_vdp, NULL))
if (!VDP_Push(ctx, req->vdc, req->ws, &h2_vdp, r2))
(void)VDP_DeliverObj(req->vdc, req->objcore);
}

Expand Down

0 comments on commit 610d177

Please sign in to comment.