<div dir="ltr">Ooops, small error present in this patch. The vdp_errval should be declared as an 'int', not unsigned.<div><br></div><div>Martin</div></div><div class="gmail_extra"><br><div class="gmail_quote">On 17 December 2014 at 14:51, Martin Blix Grydeland <span dir="ltr"><<a href="mailto:martin@varnish-software.com" target="_blank">martin@varnish-software.com</a>></span> wrote:<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Latch error values returned from any VDP function, making sure that<br>
all subsequent calls to VDP_bytes() becomes noops. This allows calling<br>
code to allow calling VDP_bytes() again even if a previous call<br>
returned error.<br>
<br>
Fixes: #1642<br>
---<br>
 bin/varnishd/cache/cache.h              | 1 +<br>
 bin/varnishd/cache/cache_deliver_proc.c | 4 ++++<br>
 bin/varnishd/cache/cache_session.c      | 1 +<br>
 3 files changed, 6 insertions(+)<br>
<br>
diff --git a/bin/varnishd/cache/cache.h b/bin/varnishd/cache/cache.h<br>
index 1db9644..f250afe 100644<br>
--- a/bin/varnishd/cache/cache.h<br>
+++ b/bin/varnishd/cache/cache.h<br>
@@ -612,6 +612,7 @@ struct req {<br>
        /* Deliver pipeline */<br>
        struct vdp_entry_s      vdp;<br>
        struct vdp_entry        *vdp_nxt;<br>
+       unsigned                vdp_errval;<br>
<br>
        /* Transaction VSL buffer */<br>
        struct vsl_log          vsl[1];<br>
diff --git a/bin/varnishd/cache/cache_deliver_proc.c b/bin/varnishd/cache/cache_deliver_proc.c<br>
index a3701a9..a74b41f 100644<br>
--- a/bin/varnishd/cache/cache_deliver_proc.c<br>
+++ b/bin/varnishd/cache/cache_deliver_proc.c<br>
@@ -40,6 +40,8 @@ VDP_bytes(struct req *req, enum vdp_action act, const void *ptr, ssize_t len)<br>
<br>
        CHECK_OBJ_NOTNULL(req, REQ_MAGIC);<br>
        assert(act == VDP_NULL || act == VDP_FLUSH);<br>
+       if (req->vdp_errval)<br>
+               return (req->vdp_errval);<br>
        vdp = req->vdp_nxt;<br>
        CHECK_OBJ_NOTNULL(vdp, VDP_ENTRY_MAGIC);<br>
        req->vdp_nxt = VTAILQ_NEXT(vdp, list);<br>
@@ -47,6 +49,8 @@ VDP_bytes(struct req *req, enum vdp_action act, const void *ptr, ssize_t len)<br>
        assert(act > VDP_NULL || len > 0);<br>
        /* Call the present layer, while pointing to the next layer down */<br>
        retval = vdp->func(req, act, &vdp->priv, ptr, len);<br>
+       if (retval)<br>
+               req->vdp_errval = retval; /* Latch error value */<br>
        req->vdp_nxt = vdp;<br>
        return (retval);<br>
 }<br>
diff --git a/bin/varnishd/cache/cache_session.c b/bin/varnishd/cache/cache_session.c<br>
index 60c893e..cf1c4d5 100644<br>
--- a/bin/varnishd/cache/cache_session.c<br>
+++ b/bin/varnishd/cache/cache_session.c<br>
@@ -373,6 +373,7 @@ SES_GetReq(const struct worker *wrk, struct sess *sp)<br>
<br>
        req->vdp_nxt = 0;<br>
        VTAILQ_INIT(&req->vdp);<br>
+       req->vdp_errval = 0;<br>
<br>
        return (req);<br>
 }<br>
<span class="HOEnZb"><font color="#888888">--<br>
2.1.3<br>
<br>
</font></span></blockquote></div><br clear="all"><div><br></div>-- <br><div class="gmail_signature"><div dir="ltr"><div><div><table border="0" cellpadding="0" cellspacing="0" style="font-size:12px;line-height:1.5em;font-family:'Helvetica Neue',Arial,sans-serif;color:rgb(102,102,102);width:550px;border-top-width:1px;border-top-style:solid;border-top-color:rgb(238,238,238);border-bottom-width:1px;border-bottom-style:solid;border-bottom-color:rgb(238,238,238);margin-top:20px;padding-top:5px;padding-bottom:5px"><tbody><tr><td width="100"><a href="http://varnish-software.com" target="_blank"><img src="http://www.varnish-software.com/static/media/logo-email.png"></a><span></span><span></span></td><td><strong style="font-size:14px;color:rgb(34,34,34)">Martin Blix Grydeland</strong><br>Senior Developer | Varnish Software AS<br>Mobile: +47 992 74 756<br><span style="font-weight:bold">We Make Websites Fly!</span></td></tr></tbody></table></div></div></div></div>
</div>