summaryrefslogtreecommitdiff
path: root/socket
diff options
context:
space:
mode:
authorMarcus Lundblad <ml@update.uu.se>2010-10-28 22:33:02 +0200
committerYouness Alaoui <youness.alaoui@collabora.co.uk>2010-12-14 20:53:05 -0500
commit8d87008a85e85967d05b3898c17a022ffbb2a079 (patch)
tree9e3dd65a78d64a3f0c158ce854a1dfc152d7e968 /socket
parentd6be49fd5656770687786d06fd537be6b34a8385 (diff)
downloadlibnice-8d87008a85e85967d05b3898c17a022ffbb2a079.tar.gz
Re-arrange the code when obtaining a permission and enqueueing data
Diffstat (limited to 'socket')
-rw-r--r--socket/turn.c11
1 files changed, 4 insertions, 7 deletions
diff --git a/socket/turn.c b/socket/turn.c
index 79de7b3..fcec137 100644
--- a/socket/turn.c
+++ b/socket/turn.c
@@ -553,13 +553,6 @@ socket_send (NiceSocket *sock, const NiceAddress *to,
}
if (msg_len > 0) {
- if (priv->compatibility == NICE_TURN_SOCKET_COMPATIBILITY_RFC5766) {
- if (!priv_has_permission_for_peer (priv, to) &&
- !priv_has_sent_permission_for_peer (priv, to)) {
- priv_send_create_permission (priv, NULL, 0, NULL, 0, to);
- }
- }
-
if (!priv->current_binding_msg && binding && !binding->active) {
nice_debug("renewing channel binding");
priv_send_channel_bind (priv, NULL, binding->channel, to);
@@ -567,6 +560,10 @@ socket_send (NiceSocket *sock, const NiceAddress *to,
if (priv->compatibility == NICE_TURN_SOCKET_COMPATIBILITY_RFC5766 &&
!priv_has_permission_for_peer (priv, to)) {
+ if (!priv_has_sent_permission_for_peer (priv, to)) {
+ priv_send_create_permission (priv, NULL, 0, NULL, 0, to);
+ }
+
/* enque data */
nice_debug("enqueing data to be sent when aquiring permission or binding");
socket_enqueue_data(priv, to, msg_len, (gchar *)buffer);