|
|
|
@ -249,6 +249,8 @@ static void __ice_agent_initialize(struct ice_agent *ag) { |
|
|
|
|
|
|
|
create_random_ice_string(call, &ag->ufrag[1], 8); |
|
|
|
create_random_ice_string(call, &ag->pwd[1], 26); |
|
|
|
|
|
|
|
atomic64_set(&ag->last_activity, poller_now); |
|
|
|
} |
|
|
|
|
|
|
|
static struct ice_agent *__ice_agent_new(struct call_media *media) { |
|
|
|
@ -283,11 +285,11 @@ static int __copy_cand(struct call *call, struct ice_candidate *dst, const struc |
|
|
|
} |
|
|
|
|
|
|
|
static void __ice_reset(struct ice_agent *ag) { |
|
|
|
__agent_deschedule(ag); |
|
|
|
AGENT_CLEAR2(ag, COMPLETED, NOMINATING); |
|
|
|
__ice_agent_free_components(ag); |
|
|
|
ZERO(ag->active_components); |
|
|
|
ZERO(ag->start_nominating); |
|
|
|
ZERO(ag->next_check); |
|
|
|
ZERO(ag->last_run); |
|
|
|
__ice_agent_initialize(ag); |
|
|
|
} |
|
|
|
@ -322,6 +324,7 @@ void ice_update(struct ice_agent *ag, struct stream_params *sp) { |
|
|
|
if (!ag) |
|
|
|
return; |
|
|
|
|
|
|
|
atomic64_set(&ag->last_activity, poller_now); |
|
|
|
media = ag->media; |
|
|
|
call = media->call; |
|
|
|
|
|
|
|
@ -518,7 +521,7 @@ static void __agent_schedule_abs(struct ice_agent *ag, const struct timeval *tv) |
|
|
|
if (ag->next_check.tv_sec && timeval_cmp(&ag->next_check, &nxt) <= 0) |
|
|
|
goto nope; /* already scheduled sooner */ |
|
|
|
if (!g_tree_remove(ice_agents_timers, ag)) |
|
|
|
obj_hold(ag); /* if it wasn't removed (should never happen), we make a new reference */ |
|
|
|
obj_hold(ag); /* if it wasn't removed, we make a new reference */ |
|
|
|
ag->next_check = nxt; |
|
|
|
g_tree_insert(ice_agents_timers, ag, ag); |
|
|
|
cond_broadcast(&ice_agents_timers_cond); |
|
|
|
@ -532,7 +535,7 @@ static void __agent_deschedule(struct ice_agent *ag) { |
|
|
|
goto nope; /* already descheduled */ |
|
|
|
ret = g_tree_remove(ice_agents_timers, ag); |
|
|
|
ZERO(ag->next_check); |
|
|
|
if (ret) /* should always be true */ |
|
|
|
if (ret) |
|
|
|
obj_put(ag); |
|
|
|
nope: |
|
|
|
mutex_unlock(&ice_agents_timers_lock); |
|
|
|
@ -690,6 +693,8 @@ static void __do_ice_checks(struct ice_agent *ag) { |
|
|
|
if (!ag->pwd[0].s) |
|
|
|
return; |
|
|
|
|
|
|
|
atomic64_set(&ag->last_activity, poller_now); |
|
|
|
|
|
|
|
__DBG("running checks, call "STR_FORMAT" tag "STR_FORMAT"", STR_FMT(&ag->call->callid), |
|
|
|
STR_FMT(&ag->media->monologue->tag)); |
|
|
|
|
|
|
|
@ -1049,6 +1054,8 @@ int ice_request(struct packet_stream *ps, struct sockaddr_in6 *src, struct in6_a |
|
|
|
if (!ag) |
|
|
|
return -1; |
|
|
|
|
|
|
|
atomic64_set(&ag->last_activity, poller_now); |
|
|
|
|
|
|
|
ifa = get_interface_from_address(ag->local_interface, dst); |
|
|
|
err = "ICE/STUN binding request received on unknown local interface address"; |
|
|
|
if (!ifa) |
|
|
|
@ -1157,6 +1164,8 @@ int ice_response(struct packet_stream *ps, struct sockaddr_in6 *src, struct in6_ |
|
|
|
if (!ag) |
|
|
|
return -1; |
|
|
|
|
|
|
|
atomic64_set(&ag->last_activity, poller_now); |
|
|
|
|
|
|
|
mutex_lock(&ag->lock); |
|
|
|
|
|
|
|
pair = g_hash_table_lookup(ag->transaction_hash, transaction); |
|
|
|
|