|
|
|
|
@ -23,7 +23,7 @@ struct janus_session { // "login" session
|
|
|
|
|
struct obj obj;
|
|
|
|
|
uint64_t id;
|
|
|
|
|
mutex_t lock;
|
|
|
|
|
time_t last_act;
|
|
|
|
|
int64_t last_act;
|
|
|
|
|
janus_websockets_ht websockets; // controlling transports, websocket_conn -> websocket_conn
|
|
|
|
|
janus_handles_set handles; // handle ID -> 0x1. handle ID owned by janus_handles
|
|
|
|
|
};
|
|
|
|
|
@ -55,7 +55,7 @@ struct janus_room {
|
|
|
|
|
TYPED_GHASHTABLE(janus_rooms_ht, uint64_t, struct janus_room, int64_hash, int64_eq, NULL, NULL)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
TYPED_GHASHTABLE(janus_tokens_ht, char, time_t, c_str_hash, c_str_equal, g_free, g_free)
|
|
|
|
|
TYPED_GHASHTABLE(janus_tokens_ht, char, int64_t, c_str_hash, c_str_equal, g_free, g_free)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static mutex_t janus_lock = MUTEX_STATIC_INIT;
|
|
|
|
|
@ -86,7 +86,7 @@ static struct janus_session *janus_get_session(uint64_t id) {
|
|
|
|
|
if (!ret)
|
|
|
|
|
return NULL;
|
|
|
|
|
mutex_lock(&ret->lock);
|
|
|
|
|
ret->last_act = timeval_from_us(rtpe_now).tv_sec;
|
|
|
|
|
ret->last_act = rtpe_now;
|
|
|
|
|
mutex_unlock(&ret->lock);
|
|
|
|
|
return ret;
|
|
|
|
|
}
|
|
|
|
|
@ -1150,8 +1150,8 @@ static const char *janus_add_token(JsonReader *reader, JsonBuilder *builder, boo
|
|
|
|
|
if (!token)
|
|
|
|
|
return "JSON object does not contain 'token' key";
|
|
|
|
|
|
|
|
|
|
time_t *now = g_malloc(sizeof(*now));
|
|
|
|
|
*now = timeval_from_us(rtpe_now).tv_sec;
|
|
|
|
|
int64_t *now = g_malloc(sizeof(*now));
|
|
|
|
|
*now = rtpe_now;
|
|
|
|
|
mutex_lock(&janus_lock);
|
|
|
|
|
t_hash_table_replace(janus_tokens, g_strdup(token), now);
|
|
|
|
|
mutex_unlock(&janus_lock);
|
|
|
|
|
@ -1180,7 +1180,7 @@ static const char *janus_create(JsonReader *reader, JsonBuilder *builder, struct
|
|
|
|
|
__auto_type session = obj_alloc0(struct janus_session, __janus_session_free);
|
|
|
|
|
mutex_init(&session->lock);
|
|
|
|
|
mutex_lock(&session->lock); // not really necessary but Coverity complains
|
|
|
|
|
session->last_act = timeval_from_us(rtpe_now).tv_sec;
|
|
|
|
|
session->last_act = rtpe_now;
|
|
|
|
|
session->websockets = janus_websockets_ht_new();
|
|
|
|
|
session->handles = janus_handles_set_new();
|
|
|
|
|
|
|
|
|
|
|