diff options
author | Karl Vogel <karl.vogel@gmail.com> | 2014-02-11 12:37:08 +0400 |
---|---|---|
committer | Felix Fietkau <nbd@openwrt.org> | 2014-02-23 21:18:32 +0400 |
commit | 926121113b903bf7b6133f782c84d0ed6c1a1a58 (patch) | |
tree | a80504b83b97eef48ced3d819f7f3cdd3eae1063 /uloop.c | |
parent | 43d2d349cb86a79d3d86012b101c458d344b05a4 (diff) |
uloop: Add flag to allow callback to be called on error conditions.
In some conditions, an application is interested in errors happening
on a file descriptor and might be able to resolve the issue in the
callback function.
This patch adds a flag to notify the uloop framework that errors
should be passed to the callback function, instead of silently
removing the fd from the polling set.
Signed-off-by: Karl Vogel <karl.vogel@gmail.com>
Diffstat (limited to 'uloop.c')
-rw-r--r-- | uloop.c | 6 |
1 files changed, 4 insertions, 2 deletions
@@ -174,7 +174,8 @@ static int uloop_fetch_events(int timeout) if (events[n].flags & EV_ERROR) { u->error = true; - uloop_fd_delete(u); + if (!(u->flags & ULOOP_ERROR_CB)) + uloop_fd_delete(u); } if(events[n].filter == EVFILT_READ) @@ -268,7 +269,8 @@ static int uloop_fetch_events(int timeout) if (events[n].events & (EPOLLERR|EPOLLHUP)) { u->error = true; - uloop_fd_delete(u); + if (!(u->flags & ULOOP_ERROR_CB)) + uloop_fd_delete(u); } if(!(events[n].events & (EPOLLRDHUP|EPOLLIN|EPOLLOUT|EPOLLERR|EPOLLHUP))) { |