Commit c5bd5e83 authored by Geoff Simmons's avatar Geoff Simmons

Merge branch 'mvp_fixes' of code.uplex.de:uplex-varnish/libvdfp-pipe into mvp_fixes

parents e16dc7b0 684aa039
......@@ -2,10 +2,13 @@
while read line
do
echo >&2 append $1 while read
echo $line
sleep 1
echo append $1
done
echo >&2 append $1 before final
echo final $1
echo >&2 append $1 after final
exit 0
......@@ -27,6 +27,17 @@ varnish v1 -arg "-p debug=+syncvsl" -vcl+backend {
}
} -start
logexpect l1001 -v v1 -q "vxid == 1001" -i Error {
expect 0 1001 Error "stderr: append 1 while read$"
expect 0 = Error "stderr: append 2 while read$"
expect 0 = Error "stderr: append 2 while read$"
expect 0 = Error "stderr: append 2 while read$"
expect ? = Error "stderr: append 2 before final$"
expect ? = Error "stderr: append 2 after final$"
expect ? = Error "stderr: append 1 before final$"
expect ? = Error "stderr: append 1 after final$"
} -start
client c1 {
txreq
rxresp
......@@ -41,3 +52,5 @@ final 2
}
} -run
logexpect l1001 -wait
\ No newline at end of file
......@@ -27,6 +27,7 @@ client c1 {
logexpect l1 -v v1 -g vxid -d 1 -q Error {
expect 0 * Begin {^req \d+ rxreq$}
expect * = Error {^vdfp_pipe: vdp cat: ${cat} stderr: }
expect * = Error {^vdfp_pipe: vdp cat: ${cat} exited with status 1}
expect * = End
} -run
......
......@@ -457,10 +457,10 @@ vdp_bytes(struct vdp_ctx *ctx, enum vdp_action act, void **priv,
closefd(&fds[STDERR_FILENO].fd);
continue;
}
close_all(fds);
if (act_bytes == VDP_END)
return (0);
return (VDP_bytes(ctx, VDP_END, NULL, 0));
closefd(&fds[STDOUT_FILENO].fd);
if (act_bytes != VDP_END)
VDP_bytes(ctx, VDP_END, NULL, 0);
continue;
}
errno = 0;
nbytes = read(fds[i].fd, state->buf, obj->bufsz);
......@@ -473,17 +473,12 @@ vdp_bytes(struct vdp_ctx *ctx, enum vdp_action act, void **priv,
close_all(fds);
return (-1);
}
assert(nbytes > 0);
if (i == STDOUT_FILENO &&
fds[i].revents & POLLHUP &&
nbytes < obj->bufsz) {
act_bytes = VDP_END;
}
if (nbytes == 0) {
if (i == STDOUT_FILENO)
closefd(&fds[STDOUT_FILENO].fd);
else
closefd(&fds[STDERR_FILENO].fd);
}
if (i == STDOUT_FILENO) {
retval = VDP_bytes(ctx, act_bytes, state->buf,
nbytes);
......
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