Commit 8f2d2e7b authored by Poul-Henning Kamp's avatar Poul-Henning Kamp

Make FetchBody() pool-task compatible.

Add #ifdef 0'ed code to put another thread on body-fetching

Hugely inpired by patches from:	martin
parent 071d9050
......@@ -479,6 +479,8 @@ struct busyobj {
struct http_conn htc;
enum body_status body_status;
struct pool_task task;
struct vef_priv *vef_priv;
unsigned should_close;
......@@ -755,7 +757,7 @@ struct storage *FetchStorage(struct busyobj *, ssize_t sz);
int FetchError(struct busyobj *, const char *error);
int FetchError2(struct busyobj *, const char *error, const char *more);
int FetchHdr(struct sess *sp, int need_host_hdr, int sendbody);
void FetchBody(struct worker *w, struct busyobj *bo);
void FetchBody(struct worker *w, void *bo);
int FetchReqBody(const struct sess *sp, int sendbody);
void Fetch_Init(void);
......
......@@ -903,8 +903,19 @@ 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);
bo->fetch_obj = NULL;
#else
bo->task.func = FetchBody;
bo->task.priv = bo;
if (Pool_Task(wrk->pool, &bo->task, POOL_NO_QUEUE)) {
FetchBody(wrk, bo);
} else {
while (bo->state < BOS_FAILED)
(void)usleep(10000);
}
#endif
assert(bo->state >= BOS_FAILED);
http_Teardown(bo->bereq);
http_Teardown(bo->beresp);
......
......@@ -530,7 +530,7 @@ FetchHdr(struct sess *sp, int need_host_hdr, int sendbody)
/*--------------------------------------------------------------------*/
void
FetchBody(struct worker *wrk, struct busyobj *bo)
FetchBody(struct worker *wrk, void *priv)
{
int cls;
struct storage *st;
......@@ -538,9 +538,10 @@ FetchBody(struct worker *wrk, struct busyobj *bo)
ssize_t cl;
struct http_conn *htc;
struct object *obj;
struct busyobj *bo;
CHECK_OBJ_NOTNULL(wrk, WORKER_MAGIC);
CHECK_OBJ_NOTNULL(bo, BUSYOBJ_MAGIC);
CAST_OBJ_NOTNULL(bo, priv, BUSYOBJ_MAGIC);
CHECK_OBJ_NOTNULL(bo->vbc, VBC_MAGIC);
obj = bo->fetch_obj;
CHECK_OBJ_NOTNULL(obj, OBJECT_MAGIC);
......
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