+ 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;
+
+ due = source->due;
+#if HAVE_LIBUSB_1_0 && !defined(G_OS_WIN32)
+ if (usb_due < due && poll_object
+ == (gintptr)session->ctx->libusb_ctx)
+ due = usb_due;
+#endif
+ if (revents == 0 && stop_time < due)
+ continue;
+ /*
+ * The source may be gone after the callback returns,
+ * so access any data now that needs accessing.
+ */
+ if (source->timeout >= 0)
+ source->due = stop_time + source->timeout;
+ source->triggered = TRUE;
+ triggered = TRUE;
+ /*
+ * Invoke the source's callback on an event or timeout.
+ */
+ if (!source->cb(fd, revents, source->cb_data))
+ sr_session_source_remove_internal(session, poll_object);