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

Always try to set another thread on the body-fetch job.

Slight rearrangement of FetchBody()
parent 59c6ae45
......@@ -903,18 +903,13 @@ cnt_fetchbody(struct sess *sp, struct worker *wrk, struct req *req)
bo = req->busyobj;
CHECK_OBJ_NOTNULL(bo, BUSYOBJ_MAGIC);
#if 1
FetchBody(wrk, bo);
#else
bo->fetch_task.func = FetchBody;
bo->fetch_task.priv = bo;
if (Pool_Task(wrk->pool, &bo->fetch_task, POOL_NO_QUEUE)) {
if (Pool_Task(wrk->pool, &bo->fetch_task, POOL_NO_QUEUE))
FetchBody(wrk, bo);
} else {
while (bo->state < BOS_FAILED)
(void)usleep(10000);
}
#endif
while (bo->state < BOS_FAILED)
(void)usleep(10000);
assert(bo->state >= BOS_FAILED);
http_Teardown(bo->bereq);
......
......@@ -627,44 +627,43 @@ FetchBody(struct worker *wrk, void *priv)
wrk->stats.fetch_failed++;
VDI_CloseFd(&bo->vbc);
obj->len = 0;
bo->stats = NULL;
return;
}
assert(bo->state == BOS_FETCHING);
} else {
assert(bo->state == BOS_FETCHING);
if (cls == 0 && bo->should_close)
cls = 1;
if (cls == 0 && bo->should_close)
cls = 1;
VSLb(bo->vsl, SLT_Length, "%zd", obj->len);
VSLb(bo->vsl, SLT_Length, "%zd", obj->len);
{
/* Sanity check fetch methods accounting */
ssize_t uu;
{
/* Sanity check fetch methods accounting */
ssize_t uu;
uu = 0;
VTAILQ_FOREACH(st, &obj->store, list)
uu += st->len;
if (bo->do_stream)
/* Streaming might have started freeing stuff */
assert (uu <= obj->len);
uu = 0;
VTAILQ_FOREACH(st, &obj->store, list)
uu += st->len;
if (bo->do_stream)
/* Streaming might have started freeing stuff */
assert (uu <= obj->len);
else
assert(uu == obj->len);
}
else
assert(uu == obj->len);
}
if (mklen > 0) {
http_Unset(obj->http, H_Content_Length);
http_PrintfHeader(obj->http, "Content-Length: %zd", obj->len);
}
if (mklen > 0) {
http_Unset(obj->http, H_Content_Length);
http_PrintfHeader(obj->http,
"Content-Length: %zd", obj->len);
}
bo->state = BOS_FINISHED;
bo->state = BOS_FINISHED;
if (cls)
VDI_CloseFd(&bo->vbc);
else
VDI_RecycleFd(&bo->vbc);
if (cls)
VDI_CloseFd(&bo->vbc);
else
VDI_RecycleFd(&bo->vbc);
}
bo->stats = NULL;
}
......
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