Commit 1184eddd authored by Poul-Henning Kamp's avatar Poul-Henning Kamp

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
parent 4f17a119
......@@ -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);
......
......@@ -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;
......
......@@ -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);
}
......
......@@ -55,6 +55,13 @@
/*--------------------------------------------------------------------
*/
int
WRW_Error(const struct worker *w)
{
return (w->wrw.werr);
}
void
WRW_Reserve(struct worker *w, int *fd)
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment