Commit e2f46325 authored by Youness Alaoui's avatar Youness Alaoui

Call stun_agent_forget_transaction when a transaction times out to avoid using...

Call stun_agent_forget_transaction when a transaction times out to avoid using all the saved id slots in the stun agent
parent c62fc437
......@@ -265,13 +265,23 @@ static gboolean priv_conn_check_tick_stream (Stream *stream, NiceAgent *agent, G
} else if (priv_timer_expired (&p->next_tick, now)) {
switch (stun_timer_refresh (&p->timer)) {
case STUN_USAGE_TIMER_RETURN_TIMEOUT:
/* case: error, abort processing */
nice_debug ("Agent %p : Retransmissions failed, giving up on connectivity check %p", agent, p);
p->state = NICE_CHECK_FAILED;
nice_debug ("Agent %p : pair %p state FAILED", agent, p);
p->stun_message.buffer = NULL;
p->stun_message.buffer_len = 0;
break;
{
/* case: error, abort processing */
StunTransactionId id;
nice_debug ("Agent %p : Retransmissions failed, giving up on connectivity check %p", agent, p);
p->state = NICE_CHECK_FAILED;
nice_debug ("Agent %p : pair %p state FAILED", agent, p);
stun_message_id (&p->stun_message, id);
stun_agent_forget_transaction (&agent->stun_agent, id);
p->stun_message.buffer = NULL;
p->stun_message.buffer_len = 0;
break;
}
case STUN_USAGE_TIMER_RETURN_RETRANSMIT:
{
/* case: not ready, so schedule a new timeout */
......@@ -471,13 +481,21 @@ static gboolean priv_conn_keepalive_retransmissions_tick (gpointer pointer)
switch (stun_timer_refresh (&pair->keepalive.timer)) {
case STUN_USAGE_TIMER_RETURN_TIMEOUT:
/* Time out */
nice_debug ("Agent %p : Keepalive conncheck timed out!! "
"peer probably lost connection", pair->keepalive.agent);
agent_signal_component_state_change (pair->keepalive.agent,
pair->keepalive.stream_id, pair->keepalive.component_id,
NICE_COMPONENT_STATE_FAILED);
break;
{
/* Time out */
StunTransactionId id;
stun_message_id (&pair->keepalive.stun_message, id);
stun_agent_forget_transaction (&pair->keepalive.agent->stun_agent, id);
nice_debug ("Agent %p : Keepalive conncheck timed out!! "
"peer probably lost connection", pair->keepalive.agent);
agent_signal_component_state_change (pair->keepalive.agent,
pair->keepalive.stream_id, pair->keepalive.component_id,
NICE_COMPONENT_STATE_FAILED);
break;
}
case STUN_USAGE_TIMER_RETURN_RETRANSMIT:
/* Retransmit */
nice_socket_send (pair->local->sockptr, &pair->remote->addr,
......@@ -676,9 +694,16 @@ static gboolean priv_turn_allocate_refresh_retransmissions_tick (gpointer pointe
switch (stun_timer_refresh (&cand->timer)) {
case STUN_USAGE_TIMER_RETURN_TIMEOUT:
/* Time out */
refresh_cancel (cand);
break;
{
/* Time out */
StunTransactionId id;
stun_message_id (&cand->stun_message, id);
stun_agent_forget_transaction (&cand->stun_agent, id);
refresh_cancel (cand);
break;
}
case STUN_USAGE_TIMER_RETURN_RETRANSMIT:
/* Retransmit */
nice_socket_send (cand->nicesock, &cand->server,
......
......@@ -173,6 +173,13 @@ void refresh_free_item (gpointer data, gpointer user_data)
agent_to_turn_compatibility (agent));
if (buffer_len > 0) {
StunTransactionId id;
/* forget the transaction since we don't care about the result and
* we don't implement retransmissions/timeout */
stun_message_id (&cand->stun_message, id);
stun_agent_forget_transaction (&cand->stun_agent, id);
/* send the refresh twice since we won't do retransmissions */
nice_socket_send (cand->nicesock, &cand->server,
buffer_len, (gchar *)cand->stun_buffer);
......@@ -895,12 +902,20 @@ static gboolean priv_discovery_tick_unlocked (gpointer pointer)
else if (priv_timer_expired (&cand->next_tick, &now)) {
switch (stun_timer_refresh (&cand->timer)) {
case STUN_USAGE_TIMER_RETURN_TIMEOUT:
/* case: error, abort processing */
cand->done = TRUE;
cand->stun_message.buffer = NULL;
cand->stun_message.buffer_len = 0;
nice_debug ("Agent %p : bind discovery timed out, aborting discovery item.", agent);
break;
{
/* Time out */
/* case: error, abort processing */
StunTransactionId id;
stun_message_id (&cand->stun_message, id);
stun_agent_forget_transaction (&cand->stun_agent, id);
cand->done = TRUE;
cand->stun_message.buffer = NULL;
cand->stun_message.buffer_len = 0;
nice_debug ("Agent %p : bind discovery timed out, aborting discovery item.", agent);
break;
}
case STUN_USAGE_TIMER_RETURN_RETRANSMIT:
{
/* case: not ready complete, so schedule next timeout */
......
......@@ -517,13 +517,21 @@ priv_retransmissions_tick_unlocked (TurnPriv *priv)
if (priv->current_binding_msg) {
switch (stun_timer_refresh (&priv->current_binding_msg->timer)) {
case STUN_USAGE_TIMER_RETURN_TIMEOUT:
/* Time out */
g_free (priv->current_binding);
priv->current_binding = NULL;
g_free (priv->current_binding_msg);
priv->current_binding_msg = NULL;
priv_process_pending_bindings (priv);
break;
{
/* Time out */
StunTransactionId id;
g_free (priv->current_binding);
priv->current_binding = NULL;
g_free (priv->current_binding_msg);
priv->current_binding_msg = NULL;
stun_message_id (&priv->current_binding_msg->message, id);
stun_agent_forget_transaction (&priv->agent, id);
priv_process_pending_bindings (priv);
break;
}
case STUN_USAGE_TIMER_RETURN_RETRANSMIT:
/* Retransmit */
nice_socket_send (priv->base_socket, &priv->server_addr,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment