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>
This commit is contained in:
parent
e7e554c194
commit
e88d816d6e
1 changed files with 7 additions and 1 deletions
|
@ -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_fd *sf = container_of(s, struct ustream_fd, stream);
|
||||||
struct ustream_buf *buf;
|
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)
|
if (!s->read_blocked && !s->eof)
|
||||||
flags |= ULOOP_READ;
|
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);
|
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;
|
return more;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue