Fix a USB timeout related issue in sr_session_iteration().
This issue could lead to e.g. crashes when an OLS was used. This fixes bug #571.
This commit is contained in:
parent
b65630f78d
commit
1190c65397
|
@ -385,9 +385,11 @@ static int sr_session_iteration(struct sr_session *session, gboolean block)
|
|||
struct timeval tv;
|
||||
#endif
|
||||
|
||||
timeout = block ? 0 : session->source_timeout;
|
||||
timeout = block ? session->source_timeout : 0;
|
||||
|
||||
#ifdef HAVE_LIBUSB_1_0
|
||||
if (session->ctx->usb_source_present) {
|
||||
timeout = block ? 0 : session->source_timeout;
|
||||
ret = libusb_get_next_timeout(session->ctx->libusb_ctx, &tv);
|
||||
if (ret < 0) {
|
||||
sr_err("Error getting libusb timeout: %s",
|
||||
|
@ -397,6 +399,7 @@ static int sr_session_iteration(struct sr_session *session, gboolean block)
|
|||
usb_timeout = tv.tv_sec * 1000 + tv.tv_usec / 1000;
|
||||
timeout = MIN(timeout, usb_timeout);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
ret = g_poll(session->pollfds, session->num_sources, timeout);
|
||||
|
|
Loading…
Reference in New Issue