Commit d1f1a6dd authored by Poul-Henning Kamp's avatar Poul-Henning Kamp

Gently shuffle things around a bit.

parent d2a7d10f
......@@ -234,6 +234,8 @@ EXP_Rearm(struct object *o, double now, double ttl, double grace, double keep)
CHECK_OBJ_NOTNULL(oc, OBJCORE_MAGIC);
assert(oc->refcnt > 0);
AN(oc->flags & OC_F_EXP);
if (!isnan(ttl))
o->exp.ttl = now + ttl - o->exp.t_origin;
if (!isnan(grace))
......@@ -253,7 +255,6 @@ EXP_Rearm(struct object *o, double now, double ttl, double grace, double keep)
CHECK_OBJ_NOTNULL(lru, LRU_MAGIC);
Lck_Lock(&lru->mtx);
AN(oc->flags & OC_F_EXP);
if (!isnan(now) && when <= now)
oc->flags |= OC_F_DYING;
......
......@@ -56,10 +56,11 @@ vbf_release_req(struct busyobj *bo)
}
/*--------------------------------------------------------------------
* Turn the beresp into a obj
*/
static int
vbf_bereq2obj(struct worker *wrk, struct busyobj *bo)
vbf_beresp2obj(struct worker *wrk, struct busyobj *bo)
{
unsigned l;
char *b;
......@@ -157,8 +158,6 @@ vbf_bereq2obj(struct worker *wrk, struct busyobj *bo)
else
obj->last_modified = floor(bo->exp.t_origin);
assert(WRW_IsReleased(wrk));
return (0);
}
......@@ -302,16 +301,16 @@ vbf_stp_fetchhdr(struct worker *wrk, struct busyobj *bo)
i = V1F_fetch_hdr(wrk, bo, bo->req);
}
if (bo->do_pass && bo->req != NULL)
vbf_release_req(bo); /* XXX : retry ?? */
AZ(bo->req);
if (i) {
AZ(bo->vbc);
return (F_STP_ERROR);
}
if (bo->do_pass && bo->req != NULL)
vbf_release_req(bo); /* XXX : retry ?? */
AZ(bo->req);
AN(bo->vbc);
http_VSL_log(bo->beresp);
......@@ -463,13 +462,15 @@ vbf_stp_fetch(struct worker *wrk, struct busyobj *bo)
if (bo->htc.body_status == BS_NONE)
bo->do_stream = 0;
if (vbf_bereq2obj(wrk, bo)) {
if (vbf_beresp2obj(wrk, bo)) {
bo->stats = NULL;
(void)VFP_Error(bo, "Could not get storage");
VDI_CloseFd(&bo->vbc);
return (F_STP_DONE);
}
assert(WRW_IsReleased(wrk));
obj = bo->fetch_obj;
/*
......@@ -536,11 +537,6 @@ vbf_stp_fetch(struct worker *wrk, struct busyobj *bo)
if (!bo->do_stream && bo->state != BOS_FAILED)
HSH_Unbusy(&wrk->stats, obj->objcore);
if (bo->state != BOS_FAILED && !(obj->objcore->flags & OC_F_PRIVATE)) {
EXP_Insert(obj->objcore);
AN(obj->objcore->ban);
}
HSH_Complete(obj->objcore);
assert(bo->refcount >= 1);
......@@ -615,10 +611,6 @@ vbf_stp_condfetch(struct worker *wrk, struct busyobj *bo)
VBO_setstate(bo, BOS_FETCHING);
HSH_Unbusy(&wrk->stats, obj->objcore);
if (!(obj->objcore->flags & OC_F_PRIVATE)) {
EXP_Insert(obj->objcore);
AN(obj->objcore->ban);
}
st = NULL;
al = 0;
......@@ -683,19 +675,17 @@ vbf_stp_error(struct worker *wrk, struct busyobj *bo)
xxxassert(wrk->handling == VCL_RET_DELIVER);
if (bo->req != NULL)
vbf_release_req(bo);
http_PrintfHeader(bo->beresp, "Content-Length: %jd", (intmax_t)0);
http_PrintfHeader(bo->beresp, "X-XXXPHK: yes");
if (vbf_bereq2obj(wrk, bo)) {
if (vbf_beresp2obj(wrk, bo)) {
INCOMPL();
}
HSH_Unbusy(&wrk->stats, bo->fetch_obj->objcore);
if (!(bo->fetch_obj->objcore->flags & OC_F_PRIVATE)) {
EXP_Insert(bo->fetch_obj->objcore);
AN(bo->fetch_obj->objcore->ban);
}
VBO_setstate(bo, BOS_FINISHED);
HSH_Complete(bo->fetch_obj->objcore);
return (F_STP_DONE);
......
......@@ -678,8 +678,12 @@ HSH_Unbusy(struct dstat *ds, struct objcore *oc)
if (oh->waitinglist != NULL)
hsh_rush(ds, oh);
Lck_Unlock(&oh->mtx);
if (!(oc->flags & OC_F_PRIVATE))
if (!(oc->flags & OC_F_PRIVATE)) {
BAN_NewObjCore(oc);
EXP_Insert(oc);
AN(oc->flags & OC_F_EXP);
AN(oc->ban);
}
}
/*---------------------------------------------------------------------
......
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