From: phk Date: Mon, 1 May 2006 12:59:12 +0000 (+0000) Subject: Use vca_write/vca_flush X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4c8f5673ec41a2d5d3f14c66a4a0d44ebda7dcc7;p=varnish Use vca_write/vca_flush git-svn-id: svn+ssh://projects.linpro.no/svn/varnish/trunk@166 d4fa192b-c00b-0410-8231-f00ffab90ce4 --- diff --git a/varnish-cache/bin/varnishd/cache_fetch.c b/varnish-cache/bin/varnishd/cache_fetch.c index 35c477d2..dbcd6c60 100644 --- a/varnish-cache/bin/varnishd/cache_fetch.c +++ b/varnish-cache/bin/varnishd/cache_fetch.c @@ -60,11 +60,9 @@ fetch_straight(struct worker *w, struct sess *sp, int fd, struct http *hp, char } http_BuildSbuf(2, w->sb, hp); - i = write(sp->fd, sbuf_data(w->sb), sbuf_len(w->sb)); - assert(i == sbuf_len(w->sb)); - - i = write(sp->fd, st->ptr, st->len); - assert(i == st->len); + vca_write(sp, sbuf_data(w->sb), sbuf_len(w->sb)); + vca_write(sp, st->ptr, st->len); + vca_flush(sp); hash->deref(sp->obj); return (0); @@ -90,8 +88,6 @@ fetch_chunked(struct worker *w, struct sess *sp, int fd, struct http *hp) 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 @@ printf("Tail: (H)\n%#H\n", b, e - b); 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 @@ printf("Buf: u %u q %p buf %p\n%#H\n", u, q, buf, buf, bp - buf); 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 @@ printf("Tail: (B)\n%#H\n", b, e - b); 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);