Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion src/serialosc-device/event_loop/poll.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,12 @@ recv_msg(struct sosc_state *state, int ipc_fd)
}
}

static int
fd_error(short revents)
{
return revents & (POLLHUP | POLLERR | POLLNVAL);
}

int
sosc_event_loop(struct sosc_state *state)
{
Expand Down Expand Up @@ -71,9 +77,13 @@ sosc_event_loop(struct sosc_state *state)
}

/* is the monome still connected? */
if (fds[0].revents & (POLLHUP | POLLERR))
if (fd_error(fds[0].revents))
break;

if (fd_error(fds[1].revents)
|| (state->ipc_in_fd > -1 && fd_error(fds[2].revents)))
return 1;

/* is there data available for reading from the monome? */
if (fds[0].revents & POLLIN)
monome_event_handle_next(state->monome);
Expand Down
Loading