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

Be more consistent about which headers we send back.

Start 5 threads in the worker pool.



git-svn-id: http://www.varnish-cache.org/svn/trunk/varnish-cache@258 d4fa192b-c00b-0410-8231-f00ffab90ce4
parent ecb9e95f
......@@ -135,7 +135,7 @@ struct backend {
/* cache_acceptor.c */
void vca_write(struct sess *sp, void *ptr, size_t len);
void vca_write_obj(struct sess *sp, struct sbuf *hdr);
void vca_write_obj(struct sess *sp, const char *b, unsigned l);
void vca_flush(struct sess *sp);
void vca_return_session(struct sess *sp);
void vca_close_session(struct sess *sp, const char *why);
......
......@@ -85,12 +85,14 @@ vca_write(struct sess *sp, void *ptr, size_t len)
}
void
vca_write_obj(struct sess *sp, struct sbuf *hdr)
vca_write_obj(struct sess *sp, const char *b, unsigned l)
{
struct storage *st;
unsigned u = 0;
vca_write(sp, sbuf_data(hdr), sbuf_len(hdr));
if (l == 0)
l = strlen(b);
vca_write(sp, b, l);
TAILQ_FOREACH(st, &sp->obj->store, list) {
u += st->len;
if (st->stevedore->send != NULL)
......
......@@ -306,7 +306,7 @@ FetchSession(struct worker *w, struct sess *sp)
sbuf_finish(w->sb);
sp->obj->header = strdup(sbuf_data(w->sb));
vca_write_obj(sp, w->sb);
vca_write_obj(sp, sp->obj->header, 0);
if (http_GetHdr(hp, "Connection", &b) && !strcasecmp(b, "close"))
cls = 1;
......
......@@ -45,13 +45,8 @@ static int
DeliverSession(struct worker *w, struct sess *sp)
{
sbuf_clear(w->sb);
sbuf_printf(w->sb,
"%sServer: Varnish\r\n"
"Content-Length: %u\r\n"
"\r\n", sp->obj->header, sp->obj->len);
vca_write_obj(sp, w->sb);
vca_write_obj(sp, sp->obj->header, 0);
HSH_Deref(sp->obj);
sp->obj = NULL;
return (1);
......@@ -147,9 +142,11 @@ void
CacheInitPool(void)
{
pthread_t tp;
int i;
AZ(pthread_cond_init(&shdcnd, NULL));
AZ(pthread_create(&tp, NULL, CacheWorker, NULL));
for (i = 0; i < 5; i++)
AZ(pthread_create(&tp, NULL, CacheWorker, NULL));
AZ(pthread_detach(tp));
}
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