r166 - trunk/varnish-cache/bin/varnishd

phk at projects.linpro.no phk at projects.linpro.no
Mon May 1 14:59:12 CEST 2006


Author: phk
Date: 2006-05-01 14:59:12 +0200 (Mon, 01 May 2006)
New Revision: 166

Modified:
   trunk/varnish-cache/bin/varnishd/cache_fetch.c
Log:
Use vca_write/vca_flush


Modified: trunk/varnish-cache/bin/varnishd/cache_fetch.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_fetch.c	2006-05-01 12:51:48 UTC (rev 165)
+++ trunk/varnish-cache/bin/varnishd/cache_fetch.c	2006-05-01 12:59:12 UTC (rev 166)
@@ -60,12 +60,10 @@
 	}
 
 	http_BuildSbuf(2, w->sb, hp);
-	i = write(sp->fd, sbuf_data(w->sb), sbuf_len(w->sb));
-	assert(i == sbuf_len(w->sb));
+	vca_write(sp, sbuf_data(w->sb), sbuf_len(w->sb));
+	vca_write(sp, st->ptr, st->len);
+	vca_flush(sp);
 
-	i = write(sp->fd, st->ptr, st->len);
-	assert(i == st->len);
-
 	hash->deref(sp->obj);
 	return (0);
 
@@ -90,8 +88,6 @@
 	while (1) {
 		bp = buf;
 		if (http_GetTail(hp, be - bp, &b, &e)) {
-if (0)
-printf("Tail: (H)\n%#H\n", b, e - b);
 			memcpy(bp, b, e - b);
 			bp += e - b;
 		} else {
@@ -100,8 +96,6 @@
 			bp += i;
 		}
 		u = strtoul(buf, &q, 16);
-if (0)
-printf("Buf: u %u q %p buf %p\n%#H\n", u, q, buf, buf, bp - buf);
 		if (q == NULL || (*q != '\n' && *q != '\r'))
 			continue;
 		if (*q == '\r')
@@ -119,8 +113,6 @@
 		p += bp - q;
 		u -= bp - q;
 		if (http_GetTail(hp, u, &b, &e)) {
-if (0)
-printf("Tail: (B)\n%#H\n", b, e - b);
 			memcpy(p, b, e - b);
 			p += e - b;
 			u -= e - b;
@@ -130,21 +122,15 @@
 			assert(i > 0);
 			u -= i;
 			p += i;
-if (0)
-printf("u = %u i = %d\n", u, i);
 		}
-if (0)
-printf("Store:\n%#H\n", st->ptr, st->len);
 	}
 
 	http_BuildSbuf(2, w->sb, hp);
-	i = write(sp->fd, sbuf_data(w->sb), sbuf_len(w->sb));
-	assert(i == sbuf_len(w->sb));
+	vca_write(sp, sbuf_data(w->sb), sbuf_len(w->sb));
 
-	TAILQ_FOREACH(st, &sp->obj->store, list) {
-		i = write(sp->fd, st->ptr, st->len);
-		assert(i == st->len);
-	}
+	TAILQ_FOREACH(st, &sp->obj->store, list)
+		vca_write(sp, st->ptr, st->len);
+	vca_flush(sp);
 
 	hash->deref(sp->obj);
 




More information about the varnish-commit mailing list