diff options
author | Youness Alaoui <youness.alaoui@collabora.co.uk> | 2009-05-24 17:20:04 -0400 |
---|---|---|
committer | Youness Alaoui <youness.alaoui@collabora.co.uk> | 2009-05-24 17:20:04 -0400 |
commit | 2dff1e17563fe584f408e0b0dd099a6213493104 (patch) | |
tree | 9dba064c98ccf7c4f2095acaa813af0f346bc70b | |
parent | 6b56e1363f7be269120c4d4c5f1cf4283d95ec6a (diff) | |
download | libnice-2dff1e17563fe584f408e0b0dd099a6213493104.tar.gz |
unse the timer's source if they return FALSE
-rw-r--r-- | TODO | 1 | ||||
-rw-r--r-- | agent/conncheck.c | 22 | ||||
-rw-r--r-- | agent/discovery.c | 7 | ||||
-rw-r--r-- | socket/turn.c | 7 |
4 files changed, 28 insertions, 9 deletions
@@ -1,5 +1,4 @@ check for the cookie and act accordingly for incoming messages. -unset the timer's source if they return FALSE channel bind have a 10 minutes expiration :@ nice_socket_recv returns -1 means we must close the nice_socket and stop all connchecks/candidates and reelect if was eleected... Add HTTP Digest support diff --git a/agent/conncheck.c b/agent/conncheck.c index 232d9a0..e4f34a0 100644 --- a/agent/conncheck.c +++ b/agent/conncheck.c @@ -256,7 +256,7 @@ static gboolean priv_conn_check_tick_stream (Stream *stream, NiceAgent *agent, G for (i = stream->conncheck_list; i ; i = i->next) { CandidateCheckPair *p = i->data; - + if (p->state == NICE_CHECK_IN_PROGRESS) { if (p->stun_message.buffer == NULL) { nice_debug ("Agent %p : STUN connectivity check was cancelled, marking as done.", agent); @@ -662,8 +662,14 @@ static gboolean priv_conn_keepalive_tick (gpointer pointer) g_static_rec_mutex_lock (&agent->mutex); ret = priv_conn_keepalive_tick_unlocked (agent); + if (ret == FALSE) { + if (agent->keepalive_timer_source) { + g_source_destroy (agent->keepalive_timer_source); + g_source_unref (agent->keepalive_timer_source); + agent->keepalive_timer_source = NULL; + } + } g_static_rec_mutex_unlock (&agent->mutex); - return ret; } @@ -756,6 +762,12 @@ static void priv_turn_allocate_refresh_tick_unlocked (CandidateRefresh *cand) nice_debug ("Agent %p : Sending allocate Refresh %d", cand->agent, buffer_len); + if (cand->tick_source != NULL) { + g_source_destroy (cand->tick_source); + g_source_unref (cand->tick_source); + cand->tick_source = NULL; + } + if (buffer_len > 0) { stun_timer_start (&cand->timer); @@ -763,12 +775,6 @@ static void priv_turn_allocate_refresh_tick_unlocked (CandidateRefresh *cand) nice_socket_send (cand->nicesock, &cand->server, buffer_len, (gchar *)cand->stun_buffer); - if (cand->tick_source != NULL) { - g_source_destroy (cand->tick_source); - g_source_unref (cand->tick_source); - cand->tick_source = NULL; - } - cand->tick_source = agent_timeout_add_with_context (cand->agent, stun_timer_remainder (&cand->timer), priv_turn_allocate_refresh_retransmissions_tick, cand); diff --git a/agent/discovery.c b/agent/discovery.c index fc34439..c12479d 100644 --- a/agent/discovery.c +++ b/agent/discovery.c @@ -975,6 +975,13 @@ static gboolean priv_discovery_tick (gpointer pointer) g_static_rec_mutex_lock (&agent->mutex); ret = priv_discovery_tick_unlocked (pointer); + if (ret == FALSE) { + if (agent->discovery_timer_source != NULL) { + g_source_destroy (agent->discovery_timer_source); + g_source_unref (agent->discovery_timer_source); + agent->discovery_timer_source = NULL; + } + } g_static_rec_mutex_unlock (&agent->mutex); return ret; diff --git a/socket/turn.c b/socket/turn.c index 541cde8..1eb24aa 100644 --- a/socket/turn.c +++ b/socket/turn.c @@ -660,6 +660,13 @@ priv_retransmissions_tick (gpointer pointer) g_static_rec_mutex_lock (&priv->nice->mutex); ret = priv_retransmissions_tick_unlocked (priv); + if (ret == FALSE) { + if (priv->tick_source != NULL) { + g_source_destroy (priv->tick_source); + g_source_unref (priv->tick_source); + priv->tick_source = NULL; + } + } g_static_rec_mutex_unlock (&priv->nice->mutex); return ret; |