Browse Source

fix call timeout when ICE fails

pull/107/head
Richard Fuchs 11 years ago
parent
commit
ba48d7b518
3 changed files with 16 additions and 5 deletions
  1. +6
    -5
      daemon/call.c
  2. +9
    -0
      daemon/ice.c
  3. +1
    -0
      daemon/ice.h

+ 6
- 5
daemon/call.c View File

@ -1083,6 +1083,7 @@ static void call_timer_iterator(void *key, void *val, void *ptr) {
struct call_monologue *ml;
GSList *i;
enum call_stream_state css;
atomic64 *timestamp;
rwlock_lock_r(&c->master_lock);
log_info_call(c);
@ -1104,6 +1105,8 @@ static void call_timer_iterator(void *key, void *val, void *ptr) {
for (it = c->streams; it; it = it->next) {
ps = it->data;
timestamp = &ps->last_packet;
if (!ps->media)
goto next;
sfd = ps->sfd;
@ -1114,10 +1117,8 @@ static void call_timer_iterator(void *key, void *val, void *ptr) {
css = call_stream_state_machine(ps);
if (css == CSS_ICE) {
good = 1;
goto next;
}
if (css == CSS_ICE)
timestamp = &ps->media->ice_agent->last_activity;
if (hlp->ports[sfd->fd.localport])
goto next;
@ -1135,7 +1136,7 @@ no_sfd:
tmp_t_reason = 2;
}
if (poller_now - atomic64_get(&ps->last_packet) < check)
if (poller_now - atomic64_get(timestamp) < check)
good = 1;
next:


+ 9
- 0
daemon/ice.c View File

@ -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) {
@ -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;
@ -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);


+ 1
- 0
daemon/ice.h View File

@ -111,6 +111,7 @@ struct ice_agent {
struct call_media *media;
struct local_interface *local_interface;
int desired_family;
atomic64 last_activity;
mutex_t lock; /* for elements below. and call must be locked in R */
/* lock order: in_lock first, then agent->lock */


Loading…
Cancel
Save