From: phk Date: Wed, 28 Jun 2006 17:46:04 +0000 (+0000) Subject: Be more consistent about which headers we send back. X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=39b7f30a1157df02e2bee769675598e72896e4be;p=varnish Be more consistent about which headers we send back. Start 5 threads in the worker pool. git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@258 d4fa192b-c00b-0410-8231-f00ffab90ce4 --- diff --git a/varnish-cache/bin/varnishd/cache.h b/varnish-cache/bin/varnishd/cache.h index 8425d9b1..f2861d69 100644 --- a/varnish-cache/bin/varnishd/cache.h +++ b/varnish-cache/bin/varnishd/cache.h @@ -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); diff --git a/varnish-cache/bin/varnishd/cache_acceptor.c b/varnish-cache/bin/varnishd/cache_acceptor.c index 281d56c1..33dd1f94 100644 --- a/varnish-cache/bin/varnishd/cache_acceptor.c +++ b/varnish-cache/bin/varnishd/cache_acceptor.c @@ -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) diff --git a/varnish-cache/bin/varnishd/cache_fetch.c b/varnish-cache/bin/varnishd/cache_fetch.c index 1eb3735e..ed55ec46 100644 --- a/varnish-cache/bin/varnishd/cache_fetch.c +++ b/varnish-cache/bin/varnishd/cache_fetch.c @@ -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; diff --git a/varnish-cache/bin/varnishd/cache_pool.c b/varnish-cache/bin/varnishd/cache_pool.c index 4699a3d8..3fd10e2a 100644 --- a/varnish-cache/bin/varnishd/cache_pool.c +++ b/varnish-cache/bin/varnishd/cache_pool.c @@ -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)); }