Commit 58e66d50 authored by Youness Alaoui's avatar Youness Alaoui

Some minor changes, code cleaning

parent a606b24f
...@@ -384,7 +384,7 @@ priv_remove_peer_from_list (GList *list, const NiceAddress *peer) ...@@ -384,7 +384,7 @@ priv_remove_peer_from_list (GList *list, const NiceAddress *peer)
NiceAddress *address = (NiceAddress *) iter->data; NiceAddress *address = (NiceAddress *) iter->data;
if (nice_address_equal (address, peer)) { if (nice_address_equal (address, peer)) {
nice_address_free ((NiceAddress *) iter->data); nice_address_free (address);
list = g_list_delete_link (list, iter); list = g_list_delete_link (list, iter);
} }
} }
...@@ -502,8 +502,7 @@ socket_send (NiceSocket *sock, const NiceAddress *to, ...@@ -502,8 +502,7 @@ socket_send (NiceSocket *sock, const NiceAddress *to,
goto send; goto send;
if (stun_message_append32 (&msg, STUN_ATTRIBUTE_MAGIC_COOKIE, if (stun_message_append32 (&msg, STUN_ATTRIBUTE_MAGIC_COOKIE,
TURN_MAGIC_COOKIE) != TURN_MAGIC_COOKIE) != STUN_MESSAGE_RETURN_SUCCESS)
STUN_MESSAGE_RETURN_SUCCESS)
goto send; goto send;
if (priv->username != NULL && priv->username_len > 0) { if (priv->username != NULL && priv->username_len > 0) {
if (stun_message_append_bytes (&msg, STUN_ATTRIBUTE_USERNAME, if (stun_message_append_bytes (&msg, STUN_ATTRIBUTE_USERNAME,
...@@ -512,8 +511,8 @@ socket_send (NiceSocket *sock, const NiceAddress *to, ...@@ -512,8 +511,8 @@ socket_send (NiceSocket *sock, const NiceAddress *to,
goto send; goto send;
} }
if (stun_message_append_addr (&msg, STUN_ATTRIBUTE_DESTINATION_ADDRESS, if (stun_message_append_addr (&msg, STUN_ATTRIBUTE_DESTINATION_ADDRESS,
(struct sockaddr *)&sa, (struct sockaddr *)&sa, sizeof(sa)) !=
sizeof(sa)) != STUN_MESSAGE_RETURN_SUCCESS) STUN_MESSAGE_RETURN_SUCCESS)
goto send; goto send;
if (priv->compatibility == NICE_TURN_SOCKET_COMPATIBILITY_GOOGLE && if (priv->compatibility == NICE_TURN_SOCKET_COMPATIBILITY_GOOGLE &&
...@@ -545,9 +544,7 @@ socket_send (NiceSocket *sock, const NiceAddress *to, ...@@ -545,9 +544,7 @@ socket_send (NiceSocket *sock, const NiceAddress *to,
req->priv = priv; req->priv = priv;
stun_message_id (&msg, req->id); stun_message_id (&msg, req->id);
req->source = agent_timeout_add_with_context (priv->nice, req->source = agent_timeout_add_with_context (priv->nice,
STUN_END_TIMEOUT, STUN_END_TIMEOUT, priv_forget_send_request, req);
priv_forget_send_request,
req);
g_queue_push_tail (priv->send_requests, req); g_queue_push_tail (priv->send_requests, req);
} }
} }
...@@ -666,8 +663,7 @@ nice_turn_socket_parse_recv (NiceSocket *sock, NiceSocket **from_sock, ...@@ -666,8 +663,7 @@ nice_turn_socket_parse_recv (NiceSocket *sock, NiceSocket **from_sock,
if (nice_address_equal (&priv->server_addr, recv_from)) { if (nice_address_equal (&priv->server_addr, recv_from)) {
valid = stun_agent_validate (&priv->agent, &msg, valid = stun_agent_validate (&priv->agent, &msg,
(uint8_t *) recv_buf, (size_t) recv_len, NULL, (uint8_t *) recv_buf, (size_t) recv_len, NULL, NULL);
NULL);
if (valid == STUN_VALIDATION_SUCCESS) { if (valid == STUN_VALIDATION_SUCCESS) {
if (priv->compatibility != NICE_TURN_SOCKET_COMPATIBILITY_DRAFT9 && if (priv->compatibility != NICE_TURN_SOCKET_COMPATIBILITY_DRAFT9 &&
...@@ -781,7 +777,7 @@ nice_turn_socket_parse_recv (NiceSocket *sock, NiceSocket **from_sock, ...@@ -781,7 +777,7 @@ nice_turn_socket_parse_recv (NiceSocket *sock, NiceSocket **from_sock,
&priv->current_binding->peer); &priv->current_binding->peer);
} else { } else {
/* look up binding associated with peer */ /* look up binding associated with peer */
GList *i = priv->channels; GList *i;
ChannelBinding *binding = NULL; ChannelBinding *binding = NULL;
struct sockaddr sa; struct sockaddr sa;
socklen_t sa_len = sizeof(sa); socklen_t sa_len = sizeof(sa);
...@@ -793,7 +789,7 @@ nice_turn_socket_parse_recv (NiceSocket *sock, NiceSocket **from_sock, ...@@ -793,7 +789,7 @@ nice_turn_socket_parse_recv (NiceSocket *sock, NiceSocket **from_sock,
&sa_len); &sa_len);
nice_address_set_from_sockaddr (&to, &sa); nice_address_set_from_sockaddr (&to, &sa);
for (; i; i = i->next) { for (i = priv->channels; i; i = i->next) {
ChannelBinding *b = i->data; ChannelBinding *b = i->data;
if (nice_address_equal (&b->peer, &to)) { if (nice_address_equal (&b->peer, &to)) {
binding = b; binding = b;
......
...@@ -238,7 +238,7 @@ static void test_turn (char *username, char *password, char *hostname, int port) ...@@ -238,7 +238,7 @@ static void test_turn (char *username, char *password, char *hostname, int port)
static void turnserver (void) static void turnserver (void)
{ {
test_turn ("toto", "password", "127.0.0.1", "3478"); test_turn ("toto", "password", "127.0.0.1", "3478");
} }
static void numb (void) static void numb (void)
......
...@@ -256,7 +256,6 @@ size_t stun_usage_turn_create_permission (StunAgent *agent, StunMessage *msg, ...@@ -256,7 +256,6 @@ size_t stun_usage_turn_create_permission (StunAgent *agent, StunMessage *msg,
return 0; return 0;
} }
stun_debug("before stun_agent_finish_message \n");
return stun_agent_finish_message (agent, msg, password, password_len); return stun_agent_finish_message (agent, msg, password, password_len);
} }
......
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