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

Move the beresp and bereq from worker ot busyobj for good.

parent 0dd1ee21
......@@ -328,10 +328,6 @@ struct worker {
/* This is only here so VRT can find it */
const char *storage_hint;
/* Fetch stuff. Here because pipe has no busyobj */
struct http *x_bereq;
struct http *x_beresp;
/* Stream state */
struct stream_ctx *sctx;
......
......@@ -43,6 +43,7 @@ struct vbo {
#define VBO_MAGIC 0xde3d8223
struct lock mtx;
unsigned refcount;
uint16_t nhttp;
struct busyobj bo;
};
......@@ -64,9 +65,20 @@ static struct vbo *
vbo_New(void)
{
struct vbo *vbo;
uint16_t nhttp;
ssize_t http_space;
ALLOC_OBJ(vbo, VBO_MAGIC);
assert(cache_param->http_max_hdr < 65536);
nhttp = (uint16_t)cache_param->http_max_hdr;
http_space = HTTP_estimate(nhttp);
vbo = malloc(sizeof *vbo + 2 * http_space);
AN(vbo);
memset(vbo, 0, sizeof *vbo);
vbo->magic = VBO_MAGIC;
vbo->nhttp = nhttp;
Lck_New(&vbo->mtx, lck_busyobj);
return (vbo);
}
......@@ -89,6 +101,7 @@ struct busyobj *
VBO_GetBusyObj(struct worker *wrk)
{
struct vbo *vbo = NULL;
char *p;
CHECK_OBJ_NOTNULL(wrk, WORKER_MAGIC);
......@@ -109,17 +122,25 @@ VBO_GetBusyObj(struct worker *wrk)
Lck_Unlock(&vbo_mtx);
}
if (vbo != NULL && vbo->nhttp != cache_param->http_max_hdr)
VBO_Free(&vbo);
if (vbo == NULL)
vbo = vbo_New();
CHECK_OBJ_NOTNULL(vbo, VBO_MAGIC);
AZ(vbo->refcount);
AZ(vbo->bo.magic);
vbo->refcount = 1;
vbo->bo.magic = BUSYOBJ_MAGIC;
vbo->bo.vbo = vbo;
vbo->bo.beresp = wrk->x_beresp;
vbo->bo.bereq = wrk->x_bereq;
p = (void*)(vbo + 1);
vbo->bo.bereq = HTTP_create(p, vbo->nhttp);
p += HTTP_estimate(vbo->nhttp);
vbo->bo.beresp = HTTP_create(p, vbo->nhttp);
return (&vbo->bo);
}
......
......@@ -196,8 +196,6 @@ Pool_Work_Thread(void *priv, struct worker *w)
Lck_AssertHeld(&pp->mtx);
CHECK_OBJ_NOTNULL(w, WORKER_MAGIC);
CHECK_OBJ_NOTNULL(w->x_bereq, HTTP_MAGIC);
CHECK_OBJ_NOTNULL(w->x_beresp, HTTP_MAGIC);
CHECK_OBJ_NOTNULL(w->resp, HTTP_MAGIC);
WS_Reset(w->ws, NULL);
......
......@@ -139,8 +139,6 @@ wrk_thread_real(void *priv, unsigned shm_workspace, unsigned sess_workspace,
uint32_t wlog[shm_workspace / 4];
/* XXX: can we trust these to be properly aligned ? */
unsigned char ws[sess_workspace];
unsigned char http0[http_space];
unsigned char http1[http_space];
unsigned char http2[http_space];
struct iovec iov[siov];
struct SHA256Context sha256;
......@@ -153,8 +151,6 @@ wrk_thread_real(void *priv, unsigned shm_workspace, unsigned sess_workspace,
w->wlb = w->wlp = wlog;
w->wle = wlog + (sizeof wlog) / 4;
w->sha256ctx = &sha256;
w->x_bereq = HTTP_create(http0, nhttp);
w->x_beresp = HTTP_create(http1, nhttp);
w->resp = HTTP_create(http2, nhttp);
w->wrw.iov = iov;
w->wrw.siov = siov;
......
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