+ fd_index = 0;
+
+ for (i = 0; i < session->sources->len; ++i) {
+ source = &g_array_index(session->sources, struct source, i);
+
+ poll_object = source->poll_object;
+ fd = (int)poll_object;
+ revents = 0;
+
+ for (k = 0; k < source->num_fds; ++k) {
+ pollfd = &g_array_index(session->pollfds,
+ GPollFD, fd_index + k);
+ fd = pollfd->fd;
+ revents |= pollfd->revents;
+ }
+ fd_index += source->num_fds;
+
+ if (source->triggered)
+ continue; /* already handled */
+ if (ret > 0 && revents == 0)
+ continue; /* skip timeouts if any I/O event occurred */
+
+ /* Make invalid to avoid confusion in case of multiple FDs. */
+ if (source->num_fds > 1)
+ fd = -1;
+ if (ret <= 0)
+ revents = 0;