diff options
author | Philip Craig <philipjcraig@gmail.com> | 2015-07-13 05:12:28 +0300 |
---|---|---|
committer | Felix Fietkau <nbd@openwrt.org> | 2015-07-14 17:57:05 +0300 |
commit | e88d816d6e462180f0337565e04e36be58a63309 (patch) | |
tree | e9106ffa629d652cb5f7fa3bee497d4225c7caf3 /ustream-fd.c | |
parent | e7e554c194d94f43b5a1e885bddbf1f092019ac4 (diff) |
ustream-fd: handle uloop errors
The default uloop error handling is to delete the fd. Continue to do
that, but also set the write_error flag and notify the user.
Signed-off-by: Philip Craig <philipjcraig@gmail.com>
Diffstat (limited to 'ustream-fd.c')
-rw-r--r-- | ustream-fd.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/ustream-fd.c b/ustream-fd.c index 5ffca53..d5abb5a 100644 --- a/ustream-fd.c +++ b/ustream-fd.c @@ -25,7 +25,7 @@ static void ustream_fd_set_uloop(struct ustream *s, bool write) { struct ustream_fd *sf = container_of(s, struct ustream_fd, stream); struct ustream_buf *buf; - unsigned int flags = ULOOP_EDGE_TRIGGER; + unsigned int flags = ULOOP_EDGE_TRIGGER | ULOOP_ERROR_CB; if (!s->read_blocked && !s->eof) flags |= ULOOP_READ; @@ -127,6 +127,12 @@ static bool __ustream_fd_poll(struct ustream_fd *sf, unsigned int events) ustream_fd_set_uloop(s, false); } + if (sf->fd.error && !s->write_error) { + ustream_state_change(s); + s->write_error = true; + ustream_fd_set_uloop(s, false); + } + return more; } |