[PATCH] MS-TURN: comments and fixes
Jakub Adam
jakub.adam at ktknet.cz
Sun Oct 3 11:36:33 PDT 2010
Added comment explaining need of nice_turn_socket_set_ms_... functions
in priv_map_reply_to_relay_request().
Fixed bug in nice_turn_socket_new() where by accident I put both STUN_AGENT_USAGE_SHORT_TERM_CREDENTIALS
and STUN_AGENT_USAGE_LONG_TERM_CREDENTIALS as usage flags to
stun_agent_init().
---
agent/conncheck.c | 10 ++++++++--
socket/turn.c | 1 -
2 files changed, 8 insertions(+), 3 deletions(-)
diff --git a/agent/conncheck.c b/agent/conncheck.c
index e53ea00..099cf82 100644
--- a/agent/conncheck.c
+++ b/agent/conncheck.c
@@ -2332,8 +2332,14 @@ static gboolean priv_map_reply_to_relay_request (NiceAgent *agent, StunMessage *
priv_add_new_turn_refresh (d, relay_cand, lifetime);
if (agent->compatibility == NICE_COMPATIBILITY_OC2007 ||
agent->compatibility == NICE_COMPATIBILITY_OC2007R2) {
- nice_turn_socket_set_ms_realm(relay_cand->sockptr, &d->stun_message);
- nice_turn_socket_set_ms_connection_id(relay_cand->sockptr, resp);
+ /* These data are needed on TURN socket when sending requests,
+ * but never reach nice_turn_socket_parse_recv() where it could
+ * be read directly, as the socket does not exist when allocate
+ * response arrives to _nice_agent_recv(). We must set them right
+ * after socket gets created in discovery_add_relay_candidate(),
+ * so we are doing it here. */
+ nice_turn_socket_set_ms_realm(relay_cand->sockptr, &d->stun_message);
+ nice_turn_socket_set_ms_connection_id(relay_cand->sockptr, resp);
}
}
diff --git a/socket/turn.c b/socket/turn.c
index 7ef0013..07999e7 100644
--- a/socket/turn.c
+++ b/socket/turn.c
@@ -141,7 +141,6 @@ nice_turn_socket_new (NiceAgent *agent, NiceAddress *addr,
} else if (compatibility == NICE_TURN_SOCKET_COMPATIBILITY_OC2007) {
stun_agent_init (&priv->agent, STUN_ALL_KNOWN_ATTRIBUTES,
STUN_COMPATIBILITY_OC2007,
- STUN_AGENT_USAGE_SHORT_TERM_CREDENTIALS |
STUN_AGENT_USAGE_NO_INDICATION_AUTH |
STUN_AGENT_USAGE_LONG_TERM_CREDENTIALS |
STUN_AGENT_USAGE_NO_ALIGNED_ATTRIBUTES);
--
1.7.1
--------------080009010003010009030300--
More information about the Nice
mailing list