r534 - trunk/varnish-cache/bin/varnishd

phk at projects.linpro.no phk at projects.linpro.no
Fri Jul 21 12:44:12 CEST 2006


Author: phk
Date: 2006-07-21 12:44:12 +0200 (Fri, 21 Jul 2006)
New Revision: 534

Modified:
   trunk/varnish-cache/bin/varnishd/cache.h
   trunk/varnish-cache/bin/varnishd/cache_center.c
   trunk/varnish-cache/bin/varnishd/cache_pass.c
   trunk/varnish-cache/bin/varnishd/cache_pipe.c
   trunk/varnish-cache/bin/varnishd/cache_pool.c
Log:
Make pipe use the new http manipulation.



Modified: trunk/varnish-cache/bin/varnishd/cache.h
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache.h	2006-07-21 09:32:09 UTC (rev 533)
+++ trunk/varnish-cache/bin/varnishd/cache.h	2006-07-21 10:44:12 UTC (rev 534)
@@ -333,7 +333,7 @@
 void PassBody(struct worker *w, struct sess *sp);
 
 /* cache_pipe.c */
-void PipeSession(struct worker *w, struct sess *sp);
+void PipeSession(struct sess *sp);
 
 /* cache_pool.c */
 void WRK_Init(void);

Modified: trunk/varnish-cache/bin/varnishd/cache_center.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_center.c	2006-07-21 09:32:09 UTC (rev 533)
+++ trunk/varnish-cache/bin/varnishd/cache_center.c	2006-07-21 10:44:12 UTC (rev 534)
@@ -477,7 +477,7 @@
 cnt_pipe(struct sess *sp)
 {
 
-	PipeSession(sp->wrk, sp);
+	PipeSession(sp);
 	sp->step = STP_DONE;
 	return (0);
 }

Modified: trunk/varnish-cache/bin/varnishd/cache_pass.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_pass.c	2006-07-21 09:32:09 UTC (rev 533)
+++ trunk/varnish-cache/bin/varnishd/cache_pass.c	2006-07-21 10:44:12 UTC (rev 534)
@@ -191,6 +191,7 @@
 	CHECK_OBJ_NOTNULL(sp, SESS_MAGIC);
 	CHECK_OBJ_NOTNULL(sp->wrk, WORKER_MAGIC);
 	w = sp->wrk;
+
 	vc = VBE_GetFd(sp->backend, sp->xid);
 	assert(vc != NULL);
 	VSL(SLT_Backend, sp->fd, "%d %s", vc->fd, sp->backend->vcl_name);
@@ -214,6 +215,5 @@
 	(void)event_base_loop(w->eb, 0);
 	http_DissectResponse(hp, vc->fd);
 
-	sp->bkd_http = hp;
 	sp->vbc = vc;
 }

Modified: trunk/varnish-cache/bin/varnishd/cache_pipe.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_pipe.c	2006-07-21 09:32:09 UTC (rev 533)
+++ trunk/varnish-cache/bin/varnishd/cache_pipe.c	2006-07-21 10:44:12 UTC (rev 534)
@@ -45,27 +45,34 @@
 }
 
 void
-PipeSession(struct worker *w, struct sess *sp)
+PipeSession(struct sess *sp)
 {
-	int i;
 	struct vbe_conn *vc;
 	struct edir e1, e2;
 	char *b, *e;
+	struct worker *w;
 
+	CHECK_OBJ_NOTNULL(sp, SESS_MAGIC);
+	CHECK_OBJ_NOTNULL(sp->wrk, WORKER_MAGIC);
+	w = sp->wrk;
+
 	vc = VBE_GetFd(sp->backend, sp->xid);
 	assert(vc != NULL);
 	VSL(SLT_Backend, sp->fd, "%d %s", vc->fd, sp->backend->vcl_name);
 
-	http_BuildSbuf(vc->fd, Build_Pipe, w->sb, sp->http);
-	i = write(vc->fd, sbuf_data(w->sb), sbuf_len(w->sb));
-	assert(i == sbuf_len(w->sb));
-	if (http_GetTail(sp->http, 0, &b, &e) && b != e) {
-		i = write(vc->fd, b, e - b);
-		if (i != e - b) {
-			close (vc->fd);
-			vca_close_session(sp, "pipe");
-			VBE_ClosedFd(vc);
-		}
+	http_CopyReq(vc->fd, vc->http, sp->http);
+	http_FilterHeader(vc->fd, vc->http, sp->http, HTTPH_R_PIPE);
+	http_PrintfHeader(vc->fd, vc->http, "X-Varnish: %u", sp->xid);
+	WRK_Reset(w, &vc->fd);
+	http_Write(w, vc->http, 0);
+
+	if (http_GetTail(sp->http, 0, &b, &e) && b != e)
+		WRK_Write(w, b, e - b);
+
+	if (WRK_Flush(w)) {
+		vca_close_session(sp, "pipe");
+		VBE_ClosedFd(vc);
+		return;
 	}
 
 	e1.fd = vc->fd;

Modified: trunk/varnish-cache/bin/varnishd/cache_pool.c
===================================================================
--- trunk/varnish-cache/bin/varnishd/cache_pool.c	2006-07-21 09:32:09 UTC (rev 533)
+++ trunk/varnish-cache/bin/varnishd/cache_pool.c	2006-07-21 10:44:12 UTC (rev 534)
@@ -50,7 +50,6 @@
 	CHECK_OBJ_NOTNULL(w, WORKER_MAGIC);
 	if (*w->wfd < 0 || w->niov == 0 || w->werr)
 		return (w->werr);
-VSL(SLT_Debug, 0, "%s %d", __func__, *w->wfd);
 	i = writev(*w->wfd, w->iov, w->niov);
 	if (i != w->liov)
 		w->werr++;




More information about the varnish-commit mailing list