X-Git-Url: http://git.archive.openwrt.org/?p=project%2Flibubox.git;a=blobdiff_plain;f=ustream-fd.c;h=5ffca53328858280e3a1bb51c944728b71fe38c7;hp=c8f0ef9aa1b2aa4dca63a1eed1dbe9d91cf9b492;hb=8964d77f806291bfbbad6a2e2b530c1838dec29c;hpb=f83b6548c792a02998e3daf7a4fcecb6e36d4a8c diff --git a/ustream-fd.c b/ustream-fd.c index c8f0ef9..5ffca53 100644 --- a/ustream-fd.c +++ b/ustream-fd.c @@ -50,6 +50,9 @@ static void ustream_fd_read_pending(struct ustream_fd *sf, bool *more) char *buf; do { + if (s->read_blocked) + break; + buf = ustream_reserve(s, 1, &buflen); if (!buf) break; @@ -66,8 +69,9 @@ static void ustream_fd_read_pending(struct ustream_fd *sf, bool *more) } if (!len) { + if (!s->eof) + ustream_state_change(s); s->eof = true; - ustream_state_change(s); ustream_fd_set_uloop(s, false); return; } @@ -118,7 +122,8 @@ static bool __ustream_fd_poll(struct ustream_fd *sf, unsigned int events) ustream_fd_read_pending(sf, &more); if (events & ULOOP_WRITE) { - if (!ustream_write_pending(s)) + bool no_more = ustream_write_pending(s); + if (no_more) ustream_fd_set_uloop(s, false); }