diff options
author | Youness Alaoui <youness.alaoui@collabora.co.uk> | 2010-12-24 03:32:15 (GMT) |
---|---|---|
committer | Youness Alaoui <youness.alaoui@collabora.co.uk> | 2010-12-24 03:50:52 (GMT) |
commit | b025bb618dc5cbf3a997c6a15711c38b4b385e82 (patch) | |
tree | a83b4930f76e318c89aee3a42bad081cd179da18 | |
parent | c4ad6fbc0a36fe2103bf65e2dfacab218ae01a7d (diff) | |
download | libnice-b025bb618dc5cbf3a997c6a15711c38b4b385e82.tar.gz libnice-b025bb618dc5cbf3a997c6a15711c38b4b385e82.tar.xz |
handle the permission response instead of having the code handled in the error case
-rw-r--r-- | socket/turn.c | 37 |
1 files changed, 19 insertions, 18 deletions
diff --git a/socket/turn.c b/socket/turn.c index b18c119..ce1ec0d 100644 --- a/socket/turn.c +++ b/socket/turn.c @@ -968,25 +968,26 @@ nice_turn_socket_parse_recv (NiceSocket *sock, NiceSocket **from_sock, priv_send_create_permission (priv, &msg, &to); return 0; } - /* If we get an error, we just assume the server somehow - doesn't support permissions and we ignore the error and - fake a successful completion. If the server needs a permission - but it failed to create it, then the connchecks will fail. */ - priv_remove_sent_permission_for_peer (priv, &to); - priv_add_permission_for_peer (priv, &to); - - /* install timer to schedule refresh of the permission */ - /* (will not schedule refresh if we got an error) */ - if (stun_message_get_class (&msg) == STUN_RESPONSE && - !priv->permission_timeout_source) { - priv->permission_timeout_source = - g_timeout_add_seconds (STUN_PERMISSION_TIMEOUT, - priv_permission_timeout, priv); - } - - /* send enqued data */ - socket_dequeue_all_data (priv, &to); } + /* If we get an error, we just assume the server somehow + doesn't support permissions and we ignore the error and + fake a successful completion. If the server needs a permission + but it failed to create it, then the connchecks will fail. */ + priv_remove_sent_permission_for_peer (priv, &to); + priv_add_permission_for_peer (priv, &to); + + /* install timer to schedule refresh of the permission */ + /* (will not schedule refresh if we got an error) */ + if (stun_message_get_class (&msg) == STUN_RESPONSE && + !priv->permission_timeout_source) { + priv->permission_timeout_source = + g_timeout_add_seconds (STUN_PERMISSION_TIMEOUT, + priv_permission_timeout, priv); + } + + /* send enqued data */ + socket_dequeue_all_data (priv, &to); + g_free (priv->current_create_permission_msg); priv->current_create_permission_msg = NULL; } |