[3.0] 82c4b09 Don't assert if we fail to get storage in VFP_Begin()
Tollef Fog Heen
tfheen at varnish-cache.org
Wed Jun 6 13:09:19 CEST 2012
commit 82c4b095509e46acdb8a5b24099527a7497084d7
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date: Wed Jun 6 10:49:39 2012 +0200
Don't assert if we fail to get storage in VFP_Begin()
Fixes #1100
Conflicts:
bin/varnishd/cache_fetch.c
bin/varnishd/cache_panic.c
diff --git a/bin/varnishd/cache_fetch.c b/bin/varnishd/cache_fetch.c
index 460cce9..de54da3 100644
--- a/bin/varnishd/cache_fetch.c
+++ b/bin/varnishd/cache_fetch.c
@@ -80,13 +80,16 @@ FetchError(const struct sess *sp, const char *error)
* VFP method functions
*/
-static void
+static int
VFP_Begin(struct sess *sp, size_t estimate)
{
CHECK_OBJ_NOTNULL(sp, SESS_MAGIC);
AN(sp->wrk->vfp);
sp->wrk->vfp->begin(sp, estimate);
+ if (sp->wrk->fetch_failed)
+ return (-1);
+ return (0);
}
static int
@@ -150,7 +153,6 @@ vfp_nop_bytes(struct sess *sp, struct http_conn *htc, ssize_t bytes)
ssize_t l, w;
struct storage *st;
- AZ(sp->wrk->fetch_failed);
while (bytes > 0) {
st = FetchStorage(sp, 0);
if (st == NULL)
@@ -555,22 +557,25 @@ FetchBody(struct sess *sp)
break;
case BS_LENGTH:
cl = fetch_number(sp->wrk->h_content_length, 10);
- VFP_Begin(sp, cl > 0 ? cl : 0);
- cls = fetch_straight(sp, w->htc, cl);
+ cls = VFP_Begin(sp, cl > 0 ? cl : 0);
+ if (!cls)
+ cls = fetch_straight(sp, w->htc, cl);
mklen = 1;
if (VFP_End(sp))
cls = -1;
break;
case BS_CHUNKED:
- VFP_Begin(sp, cl);
- cls = fetch_chunked(sp, w->htc);
+ cls = VFP_Begin(sp, cl);
+ if (!cls)
+ cls = fetch_chunked(sp, w->htc);
mklen = 1;
if (VFP_End(sp))
cls = -1;
break;
case BS_EOF:
- VFP_Begin(sp, cl);
- cls = fetch_eof(sp, w->htc);
+ cls = VFP_Begin(sp, cl);
+ if (!cls)
+ cls = fetch_eof(sp, w->htc);
mklen = 1;
if (VFP_End(sp))
cls = -1;
More information about the varnish-commit
mailing list