[master] 1184edd Do not bail out of the VGZ functions if WRW fails to write, we may still need the object.
Poul-Henning Kamp
phk at varnish-cache.org
Tue May 10 12:48:08 CEST 2011
commit 1184eddd7337d1ee6312dac629aaca0ac2fdebcf
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date: Tue May 10 10:46:50 2011 +0000
Do not bail out of the VGZ functions if WRW fails to write, we may
still need the object.
Instead, add a WRW_error() function to query if there are WRW trouble.
Fixes #904
diff --git a/bin/varnishd/cache.h b/bin/varnishd/cache.h
index fc55996..c39bfe5 100644
--- a/bin/varnishd/cache.h
+++ b/bin/varnishd/cache.h
@@ -714,7 +714,6 @@ int VGZ_WrwGunzip(struct sess *, struct vgz *, void *ibuf, ssize_t ibufl,
char *obuf, ssize_t obufl, ssize_t *obufp);
/* Return values */
-#define VGZ_SOCKET -2
#define VGZ_ERROR -1
#define VGZ_OK 0
#define VGZ_END 1
@@ -819,6 +818,7 @@ int WRK_QueueSession(struct sess *sp);
void WRK_SumStat(struct worker *w);
#define WRW_IsReleased(w) ((w)->wrw.wfd == NULL)
+int WRW_Error(const struct worker *w);
void WRW_Chunked(struct worker *w);
void WRW_EndChunk(struct worker *w);
void WRW_Reserve(struct worker *w, int *fd);
diff --git a/bin/varnishd/cache_esi_deliver.c b/bin/varnishd/cache_esi_deliver.c
index 33ce9b8..85e1b15 100644
--- a/bin/varnishd/cache_esi_deliver.c
+++ b/bin/varnishd/cache_esi_deliver.c
@@ -327,7 +327,7 @@ ESI_Deliver(struct sess *sp)
i = VGZ_WrwGunzip(sp, vgz,
st->ptr + off, l2,
obuf, sizeof obuf, &obufl);
- if (i == VGZ_SOCKET) {
+ if (WRW_Error(sp->wrk)) {
vca_close_session(sp,
"remote closed");
p = e;
diff --git a/bin/varnishd/cache_gzip.c b/bin/varnishd/cache_gzip.c
index 290da72..c48fe21 100644
--- a/bin/varnishd/cache_gzip.c
+++ b/bin/varnishd/cache_gzip.c
@@ -379,8 +379,7 @@ VGZ_WrwGunzip(struct sess *sp, struct vgz *vg, void *ibuf, ssize_t ibufl,
}
if (obufl == *obufp || i == VGZ_STUCK) {
(void)WRW_Write(sp->wrk, obuf, *obufp);
- if (WRW_Flush(sp->wrk))
- return (VGZ_SOCKET);
+ (void)WRW_Flush(sp->wrk);
*obufp = 0;
VGZ_Obuf(vg, obuf + *obufp, obufl - *obufp);
}
diff --git a/bin/varnishd/cache_wrw.c b/bin/varnishd/cache_wrw.c
index 688a5a0..5567f94 100644
--- a/bin/varnishd/cache_wrw.c
+++ b/bin/varnishd/cache_wrw.c
@@ -55,6 +55,13 @@
/*--------------------------------------------------------------------
*/
+int
+WRW_Error(const struct worker *w)
+{
+
+ return (w->wrw.werr);
+}
+
void
WRW_Reserve(struct worker *w, int *fd)
{
More information about the varnish-commit
mailing list