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

Add an explicit OC_F_INCOMPLETE flag to limit the amount of code

that needs to know about oc->busyobj semantics
parent 534aeac4
......@@ -404,6 +404,7 @@ struct objcore {
uint16_t flags;
#define OC_F_BUSY (1<<1)
#define OC_F_PASS (1<<2)
#define OC_F_INCOMPLETE (1<<3)
#define OC_F_PRIVATE (1<<8)
#define OC_F_FAILED (1<<9)
......
......@@ -231,7 +231,7 @@ EXP_Touch(struct objcore *oc, double now)
CHECK_OBJ_NOTNULL(oc, OBJCORE_MAGIC);
if (oc->busyobj != NULL)
if (oc->flags & OC_F_INCOMPLETE)
return;
if (now - oc->last_lru < cache_param->lru_interval)
......
......@@ -307,8 +307,8 @@ VDP_gunzip(struct req *req, enum vdp_action act, void **priv,
http_Unset(req->resp, H_Content_Encoding);
req->resp_len = -1;
if (req->objcore->busyobj != NULL)
return (0); /* Incomplete, no idea about length */
if (req->objcore->flags & OC_F_INCOMPLETE)
return (0); /* No idea about length */
p = ObjGetattr(req->wrk, req->objcore, OA_GZIPBITS, &dl);
if (p == NULL || dl != 32)
......
......@@ -75,7 +75,7 @@ hsh_NewObjCore(struct worker *wrk)
ALLOC_OBJ(oc, OBJCORE_MAGIC);
XXXAN(oc);
wrk->stats->n_objectcore++;
oc->flags |= OC_F_BUSY;
oc->flags |= OC_F_BUSY | OC_F_INCOMPLETE;
return (oc);
}
......@@ -650,6 +650,7 @@ HSH_Fail(struct objcore *oc)
Lck_Lock(&oh->mtx);
oc->flags |= OC_F_FAILED;
oc->flags &= ~OC_F_INCOMPLETE;
oc->busyobj = NULL;
Lck_Unlock(&oh->mtx);
}
......@@ -669,6 +670,7 @@ HSH_Complete(struct objcore *oc)
Lck_Lock(&oh->mtx);
oc->busyobj = NULL;
oc->flags &= ~OC_F_INCOMPLETE;
Lck_Unlock(&oh->mtx);
}
......
......@@ -670,7 +670,7 @@ VRT_r_resp_is_streaming(VRT_CTX)
if (ctx->req->objcore == NULL)
return (0); /* When called from vcl_synth */
CHECK_OBJ_NOTNULL(ctx->req->objcore, OBJCORE_MAGIC);
return (ctx->req->objcore->busyobj != NULL ? 1 : 0);
return (ctx->req->objcore->flags & OC_F_INCOMPLETE ? 1 : 0);
}
/*--------------------------------------------------------------------*/
......
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