Commit 77507150 authored by Nils Goroll's avatar Nils Goroll

refactor the specific vdp close function

parent 96ca4949
......@@ -287,7 +287,6 @@ struct pesi {
const struct vdp VDP_pesi_buf;
static const struct transport VPED_transport;
static void req_fini(struct req **, struct worker *);
static void vped_close_pesi_vdps(struct req *req);
// node finalizers
static void
......@@ -2410,8 +2409,13 @@ vped_reembark(struct worker *wrk, struct req *req)
Lck_Unlock(&req->sp->mtx);
}
/*
* close first vdp and assert it has the right type
*
* there must be at least one vdp remaining
*/
static void
vped_close_pesi_vdps(struct req *req)
vped_close_first_vdp(struct req *req, const struct vdp *vdp)
{
struct vdp_entry *vdpe;
struct vdp_ctx *vdc;
......@@ -2421,16 +2425,7 @@ vped_close_pesi_vdps(struct req *req)
vdc = req->vdc;
vdpe = VTAILQ_FIRST(&vdc->vdp);
CHECK_OBJ_NOTNULL(vdpe, VDP_ENTRY_MAGIC);
assert(vdpe->vdp == &VDP_pesi);
AN(vdpe->vdp->fini);
AZ(vdpe->vdp->fini(req, &vdpe->priv));
AZ(vdpe->priv);
VTAILQ_REMOVE(&vdc->vdp, vdpe, list);
vdpe = VTAILQ_FIRST(&vdc->vdp);
CHECK_OBJ_NOTNULL(vdpe, VDP_ENTRY_MAGIC);
assert(vdpe->vdp == &VDP_pesi_buf);
assert(vdpe->vdp == vdp);
AN(vdpe->vdp->fini);
AZ(vdpe->vdp->fini(req, &vdpe->priv));
AZ(vdpe->priv);
......@@ -2594,7 +2589,8 @@ vped_deliver(struct req *req, struct boc *boc, int wantbody)
* XXX cleanup
*/
clean:
vped_close_pesi_vdps(req);
vped_close_first_vdp(req, &VDP_pesi);
vped_close_first_vdp(req, &VDP_pesi_buf);
out:
Lck_Lock(&tree->tree_lock);
set_closed(tree, node);
......
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