polish

parent 5c6f8323
...@@ -518,7 +518,7 @@ set_closed(struct bytes_tree *tree, struct node *node, const struct worker *wrk) ...@@ -518,7 +518,7 @@ set_closed(struct bytes_tree *tree, struct node *node, const struct worker *wrk)
* restore the original subreq state and take care that we do not mess up flags, * restore the original subreq state and take care that we do not mess up flags,
* objcore etc * objcore etc
*/ */
static void static struct req *
subreq_fixup_oc(struct node *node) subreq_fixup_oc(struct node *node)
{ {
struct req *subreq; struct req *subreq;
...@@ -541,9 +541,11 @@ subreq_fixup_oc(struct node *node) ...@@ -541,9 +541,11 @@ subreq_fixup_oc(struct node *node)
TAKE_OBJ_NOTNULL(subreq->objcore, &node->subreq.oc, TAKE_OBJ_NOTNULL(subreq->objcore, &node->subreq.oc,
OBJCORE_MAGIC); OBJCORE_MAGIC);
} }
return (subreq);
} }
static void static struct req *
subreq_fixup(struct node *node, struct req *req) subreq_fixup(struct node *node, struct req *req)
{ {
struct req *subreq; struct req *subreq;
...@@ -553,10 +555,7 @@ subreq_fixup(struct node *node, struct req *req) ...@@ -553,10 +555,7 @@ subreq_fixup(struct node *node, struct req *req)
AN(node->subreq.done); AN(node->subreq.done);
CHECK_OBJ_NOTNULL(req, REQ_MAGIC); CHECK_OBJ_NOTNULL(req, REQ_MAGIC);
subreq = node->subreq.req; subreq = subreq_fixup_oc(node);
CHECK_OBJ_NOTNULL(subreq, REQ_MAGIC);
subreq_fixup_oc(node);
if (subreq->wrk != NULL) if (subreq->wrk != NULL)
assert(subreq->wrk == req->wrk); assert(subreq->wrk == req->wrk);
...@@ -567,6 +566,8 @@ subreq_fixup(struct node *node, struct req *req) ...@@ -567,6 +566,8 @@ subreq_fixup(struct node *node, struct req *req)
assert(subreq->top->topreq == req); assert(subreq->top->topreq == req);
else else
subreq->top->topreq = req; subreq->top->topreq = req;
return (subreq);
} }
/* ------------------------------------------------------------ /* ------------------------------------------------------------
...@@ -623,7 +624,7 @@ fini_subreq(const struct vdp_ctx *vdx, struct node *node) ...@@ -623,7 +624,7 @@ fini_subreq(const struct vdp_ctx *vdx, struct node *node)
return; return;
} }
subreq_fixup_oc(node); (void) subreq_fixup_oc(node);
TAKE_OBJ_NOTNULL(subreq, &node->subreq.req, REQ_MAGIC); TAKE_OBJ_NOTNULL(subreq, &node->subreq.req, REQ_MAGIC);
if (node->subreq.boc) if (node->subreq.boc)
...@@ -697,8 +698,9 @@ static int ...@@ -697,8 +698,9 @@ static int
push_subreq(struct req *req, struct bytes_tree *tree, push_subreq(struct req *req, struct bytes_tree *tree,
struct node *node, const struct node *next) struct node *node, const struct node *next)
{ {
assert(node->type == T_SUBREQ); struct req *subreq;
assert(node->type == T_SUBREQ);
(void) next; (void) next;
if (node->subreq.done == 0) { if (node->subreq.done == 0) {
...@@ -710,17 +712,17 @@ push_subreq(struct req *req, struct bytes_tree *tree, ...@@ -710,17 +712,17 @@ push_subreq(struct req *req, struct bytes_tree *tree,
Lck_Unlock(&tree->tree_lock); Lck_Unlock(&tree->tree_lock);
} }
subreq_fixup(node, req); subreq = subreq_fixup(node, req);
AZ(node->subreq.req->objcore->flags & OC_F_FINAL); AZ(subreq->objcore->flags & OC_F_FINAL);
VSLdbg(vdx, "DeliverObj from top"); VSLdbg(vdx, "DeliverObj from top");
/* /*
* XXX how should we handle a failed subreq? * XXX how should we handle a failed subreq?
* https://github.com/varnishcache/varnish-cache/issues/3264 * https://github.com/varnishcache/varnish-cache/issues/3264
*/ */
(void) VDP_DeliverObj(node->subreq.req->vdc, node->subreq.req->objcore); (void) VDP_DeliverObj(subreq->vdc, subreq->objcore);
node->subreq.req->acct.resp_bodybytes += VDP_Close(node->subreq.req->vdc); subreq->acct.resp_bodybytes += VDP_Close(subreq->vdc);
// fini_subreq() happening later // fini_subreq() happening later
...@@ -817,7 +819,6 @@ push_data(struct vdp_ctx *vdx, struct bytes_tree *tree, ...@@ -817,7 +819,6 @@ push_data(struct vdp_ctx *vdx, struct bytes_tree *tree,
assert(node->type == T_DATA); assert(node->type == T_DATA);
(void) tree; (void) tree;
(void) vdx;
AN(node->parent); AN(node->parent);
assert(node->parent->type == T_NEXUS); assert(node->parent->type == T_NEXUS);
...@@ -837,7 +838,8 @@ push_data(struct vdp_ctx *vdx, struct bytes_tree *tree, ...@@ -837,7 +838,8 @@ push_data(struct vdp_ctx *vdx, struct bytes_tree *tree,
if (p == NULL || node->data.len == 0) if (p == NULL || node->data.len == 0)
return (0); return (0);
return (VDP_bytes(node->parent->nexus.req->vdc, act, p, node->data.len)); vdx = node->parent->nexus.req->vdc;
return (VDP_bytes(vdx, act, p, node->data.len));
} }
/* /*
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment