Skip to content
Snippets Groups Projects
Commit 95e5fb9c authored by Christopher J. Morrone's avatar Christopher J. Morrone
Browse files

Fix to eio to handle POLLNVAL properly.

parent 1fc8cab7
No related branches found
No related tags found
No related merge requests found
......@@ -290,13 +290,7 @@ _poll_handle_event(short revents, eio_obj_t *obj, List objList)
bool read_called = false;
bool write_called = false;
if (revents & POLLNVAL) {
debug("POLLNVAL on fd %d, shutting down eio object", obj->fd);
obj->shutdown = true;
return;
}
if (revents & POLLERR) {
if (revents & POLLERR || revents & POLLNVAL) {
if (obj->ops->handle_error) {
(*obj->ops->handle_error) (obj, objList);
} else if (obj->ops->handle_read) {
......@@ -306,7 +300,9 @@ _poll_handle_event(short revents, eio_obj_t *obj, List objList)
(*obj->ops->handle_write) (obj, objList);
write_called = true;
} else {
debug("No handler for POLLERR");
debug("No handler for %s on fd %d",
revents & POLLERR ? "POLLERR" : "POLLNVAL",
obj->fd);
obj->shutdown = true;
}
return;
......
......@@ -39,6 +39,16 @@ typedef struct eio_handle_components eio_handle_t;
*
* handle_*() functions also pass the List of io_obj's from the event loop
*
* If either "handle_error" (for POLLERR and POLLNVAL) or "handle_close"
* (for POLLHUP) are not defined, the eio server will fallback to handle_read
* if defined, and fallback to handle_write if handle_read is not defined
* either.
*
* If there are no handlers at all when POLLERR or POLLNVAL occurs, the eio
* server will set the eio_obj_t shutdown flag to "true". Keep in mind
* that the shutdown flag is essentially just an advisory flag. The
* "readable" and "writable" functions have the final say over whether a
* file descriptor will continue to be polled.
*/
struct io_operations {
bool (*readable )(eio_obj_t *);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment