Commit 4442c6d7 authored by Nils Goroll's avatar Nils Goroll

move busyobj cancel handling to a seprate function

parent c9b9c6bf
......@@ -765,6 +765,35 @@ HSH_Abandon(struct objcore *oc)
Lck_Unlock(&oh->mtx);
}
/*---------------------------------------------------------------------
* Cancel a fetch when the client does not need it any more
*/
void
HSH_Cancel(struct worker *wrk, struct objcore *oc, struct boc *boc)
{
struct boc *bocref = NULL;
if ((oc->flags & (OC_F_PRIVATE | OC_F_HFM | OC_F_HFP)) == 0)
return;
if (boc == NULL)
bocref = boc = HSH_RefBoc(oc);
if (oc->flags & OC_F_HFP)
AN(oc->flags & OC_F_HFM);
if (boc != NULL) {
HSH_Abandon(oc);
ObjWaitState(oc, BOS_FINISHED);
}
if (bocref != NULL)
HSH_DerefBoc(wrk, oc);
ObjSlim(wrk, oc);
}
/*---------------------------------------------------------------------
* Unbusy an objcore when the object is completely fetched.
*/
......
......@@ -74,3 +74,4 @@ unsigned HSH_Purge(struct worker *, struct objhead *, vtim_real ttl_now,
vtim_dur ttl, vtim_dur grace, vtim_dur keep);
struct objcore *HSH_Private(const struct worker *wrk);
void HSH_Abandon(struct objcore *oc);
void HSH_Cancel(struct worker *, struct objcore *, struct boc *);
......@@ -404,15 +404,7 @@ cnt_transmit(struct worker *wrk, struct req *req)
VSLb_ts_req(req, "Resp", W_TIM_real(wrk));
if (req->objcore->flags & (OC_F_PRIVATE | OC_F_HFM | OC_F_HFP)) {
if (req->objcore->flags & OC_F_HFP)
AN(req->objcore->flags & OC_F_HFM);
if (boc != NULL) {
HSH_Abandon(req->objcore);
ObjWaitState(req->objcore, BOS_FINISHED);
}
ObjSlim(wrk, req->objcore);
}
HSH_Cancel(wrk, req->objcore, boc);
if (boc != NULL)
HSH_DerefBoc(wrk, req->objcore);
......
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