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, ...@@ -714,7 +714,6 @@ int VGZ_WrwGunzip(struct sess *, struct vgz *, void *ibuf, ssize_t ibufl,
char *obuf, ssize_t obufl, ssize_t *obufp); char *obuf, ssize_t obufl, ssize_t *obufp);
/* Return values */ /* Return values */
#define VGZ_SOCKET -2
#define VGZ_ERROR -1 #define VGZ_ERROR -1
#define VGZ_OK 0 #define VGZ_OK 0
#define VGZ_END 1 #define VGZ_END 1
...@@ -819,6 +818,7 @@ int WRK_QueueSession(struct sess *sp); ...@@ -819,6 +818,7 @@ int WRK_QueueSession(struct sess *sp);
void WRK_SumStat(struct worker *w); void WRK_SumStat(struct worker *w);
#define WRW_IsReleased(w) ((w)->wrw.wfd == NULL) #define WRW_IsReleased(w) ((w)->wrw.wfd == NULL)
int WRW_Error(const struct worker *w);
void WRW_Chunked(struct worker *w); void WRW_Chunked(struct worker *w);
void WRW_EndChunk(struct worker *w); void WRW_EndChunk(struct worker *w);
void WRW_Reserve(struct worker *w, int *fd); void WRW_Reserve(struct worker *w, int *fd);
......
...@@ -327,7 +327,7 @@ ESI_Deliver(struct sess *sp) ...@@ -327,7 +327,7 @@ ESI_Deliver(struct sess *sp)
i = VGZ_WrwGunzip(sp, vgz, i = VGZ_WrwGunzip(sp, vgz,
st->ptr + off, l2, st->ptr + off, l2,
obuf, sizeof obuf, &obufl); obuf, sizeof obuf, &obufl);
if (i == VGZ_SOCKET) { if (WRW_Error(sp->wrk)) {
vca_close_session(sp, vca_close_session(sp,
"remote closed"); "remote closed");
p = e; p = e;
......
...@@ -379,8 +379,7 @@ VGZ_WrwGunzip(struct sess *sp, struct vgz *vg, void *ibuf, ssize_t ibufl, ...@@ -379,8 +379,7 @@ VGZ_WrwGunzip(struct sess *sp, struct vgz *vg, void *ibuf, ssize_t ibufl,
} }
if (obufl == *obufp || i == VGZ_STUCK) { if (obufl == *obufp || i == VGZ_STUCK) {
(void)WRW_Write(sp->wrk, obuf, *obufp); (void)WRW_Write(sp->wrk, obuf, *obufp);
if (WRW_Flush(sp->wrk)) (void)WRW_Flush(sp->wrk);
return (VGZ_SOCKET);
*obufp = 0; *obufp = 0;
VGZ_Obuf(vg, obuf + *obufp, obufl - *obufp); VGZ_Obuf(vg, obuf + *obufp, obufl - *obufp);
} }
......
...@@ -55,6 +55,13 @@ ...@@ -55,6 +55,13 @@
/*-------------------------------------------------------------------- /*--------------------------------------------------------------------
*/ */
int
WRW_Error(const struct worker *w)
{
return (w->wrw.werr);
}
void void
WRW_Reserve(struct worker *w, int *fd) 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