Skip to content

Commit

Permalink
Fix bug in HTTP transport introduced by monotonic getter change (fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
lminiero committed Jul 15, 2024
1 parent c161ca0 commit e4f6632
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/transports/janus_http.c
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ static GSource *janus_http_request_timeout_create(janus_transport_session *ts, j
janus_http_request_timeout *t = (janus_http_request_timeout *)source;
t->ts = ts;
t->session = session;
g_source_set_ready_time(source, janus_get_monotonic_time() + timeout*G_USEC_PER_SEC);
g_source_set_ready_time(source, janus_get_monotonic_time_internal() + timeout*G_USEC_PER_SEC);
JANUS_LOG(LOG_DBG, "[%p] create (%d)\n", source, timeout);
return source;
}
Expand Down
2 changes: 1 addition & 1 deletion src/utils.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
#include "mach_gettime.h"
#endif

static gint64 janus_get_monotonic_time_internal(void) {
gint64 janus_get_monotonic_time_internal(void) {
struct timespec ts;
clock_gettime (CLOCK_MONOTONIC, &ts);
return (ts.tv_sec*G_GINT64_CONSTANT(1000000)) + (ts.tv_nsec/G_GINT64_CONSTANT(1000));
Expand Down
5 changes: 5 additions & 0 deletions src/utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,11 @@ struct janus_json_parameter {
/*! Helper method used by the core to mark when Janus started */
void janus_mark_started(void);

/*! \brief Helper to retrieve the system monotonic time, as Glib's
* g_get_monotonic_time may not be available (only since 2.28)
* @returns The system monotonic time */
gint64 janus_get_monotonic_time_internal(void);

/*! \brief Helper to retrieve the system monotonic time, as Glib's
* g_get_monotonic_time may not be available (only since 2.28)
* @note The monotonic time will be normalized from the Janus start time
Expand Down

0 comments on commit e4f6632

Please sign in to comment.