r258 - trunk/varnish-cache/bin/varnishd
phk at projects.linpro.no
phk at projects.linpro.no
Wed Jun 28 19:46:04 CEST 2006
Author: phk
Date: 2006-06-28 19:46:04 +0200 (Wed, 28 Jun 2006)
New Revision: 258
Modified:
trunk/varnish-cache/bin/varnishd/cache.h
trunk/varnish-cache/bin/varnishd/cache_acceptor.c
trunk/varnish-cache/bin/varnishd/cache_fetch.c
trunk/varnish-cache/bin/varnishd/cache_pool.c
Log:
Be more consistent about which headers we send back.
Start 5 threads in the worker pool.
Modified: trunk/varnish-cache/bin/varnishd/cache.h
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache.h 2006-06-28 16:59:07 UTC (rev 257)
+++ trunk/varnish-cache/bin/varnishd/cache.h 2006-06-28 17:46:04 UTC (rev 258)
@@ -135,7 +135,7 @@
/* 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);
Modified: trunk/varnish-cache/bin/varnishd/cache_acceptor.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_acceptor.c 2006-06-28 16:59:07 UTC (rev 257)
+++ trunk/varnish-cache/bin/varnishd/cache_acceptor.c 2006-06-28 17:46:04 UTC (rev 258)
@@ -85,12 +85,14 @@
}
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)
Modified: trunk/varnish-cache/bin/varnishd/cache_fetch.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_fetch.c 2006-06-28 16:59:07 UTC (rev 257)
+++ trunk/varnish-cache/bin/varnishd/cache_fetch.c 2006-06-28 17:46:04 UTC (rev 258)
@@ -306,7 +306,7 @@
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;
Modified: trunk/varnish-cache/bin/varnishd/cache_pool.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_pool.c 2006-06-28 16:59:07 UTC (rev 257)
+++ trunk/varnish-cache/bin/varnishd/cache_pool.c 2006-06-28 17:46:04 UTC (rev 258)
@@ -45,13 +45,8 @@
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 @@
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));
}
More information about the varnish-commit
mailing list