Commit 1c6b6ad4 authored by Youness Alaoui's avatar Youness Alaoui

remove the use of sockaddr and the memcopy, and use nice_address_get_port directly

parent 67fe676f
...@@ -569,11 +569,6 @@ static gboolean priv_conn_keepalive_tick_unlocked (NiceAgent *agent) ...@@ -569,11 +569,6 @@ static gboolean priv_conn_keepalive_tick_unlocked (NiceAgent *agent)
Component *component = j->data; Component *component = j->data;
if (component->selected_pair.local != NULL) { if (component->selected_pair.local != NULL) {
CandidatePair *p = &component->selected_pair; CandidatePair *p = &component->selected_pair;
struct sockaddr_storage sockaddr;
memset (&sockaddr, 0, sizeof (sockaddr));
nice_address_copy_to_sockaddr (&p->remote->addr,
(struct sockaddr *) &sockaddr);
if (agent->compatibility == NICE_COMPATIBILITY_GOOGLE) { if (agent->compatibility == NICE_COMPATIBILITY_GOOGLE) {
guint32 priority = nice_candidate_ice_priority_full ( guint32 priority = nice_candidate_ice_priority_full (
...@@ -593,7 +588,7 @@ static gboolean priv_conn_keepalive_tick_unlocked (NiceAgent *agent) ...@@ -593,7 +588,7 @@ static gboolean priv_conn_keepalive_tick_unlocked (NiceAgent *agent)
nice_debug ("Agent %p : Keepalive STUN-CC REQ to '%s:%u', " nice_debug ("Agent %p : Keepalive STUN-CC REQ to '%s:%u', "
"socket=%u (c-id:%u), username='%s' (%d), " "socket=%u (c-id:%u), username='%s' (%d), "
"password='%s' (%d), priority=%u.", agent, "password='%s' (%d), priority=%u.", agent,
tmpbuf, ntohs(((struct sockaddr_in*)(&sockaddr))->sin_port), tmpbuf, nice_address_get_port (&p->remote->addr),
p->local->sockptr->fileno, component->id, p->local->sockptr->fileno, component->id,
uname, uname_len, password, password_len, priority); uname, uname_len, password, password_len, priority);
...@@ -1637,25 +1632,18 @@ int conn_check_send (NiceAgent *agent, CandidateCheckPair *pair) ...@@ -1637,25 +1632,18 @@ int conn_check_send (NiceAgent *agent, CandidateCheckPair *pair)
/* XXX: add API to support different nomination modes: */ /* XXX: add API to support different nomination modes: */
bool cand_use = controlling; bool cand_use = controlling;
size_t buffer_len; size_t buffer_len;
struct sockaddr_storage sockaddr;
unsigned int timeout; unsigned int timeout;
if (agent->compatibility == NICE_COMPATIBILITY_MSN) { if (agent->compatibility == NICE_COMPATIBILITY_MSN) {
password = g_base64_decode ((gchar *) password, &password_len); password = g_base64_decode ((gchar *) password, &password_len);
} }
memset (&sockaddr, 0, sizeof (sockaddr));
nice_address_copy_to_sockaddr (&pair->remote->addr,
(struct sockaddr *) &sockaddr);
{ {
gchar tmpbuf[INET6_ADDRSTRLEN]; gchar tmpbuf[INET6_ADDRSTRLEN];
nice_address_to_string (&pair->remote->addr, tmpbuf); nice_address_to_string (&pair->remote->addr, tmpbuf);
nice_debug ("Agent %p : STUN-CC REQ to '%s:%u', socket=%u, pair=%s (c-id:%u), tie=%llu, username='%s' (%d), password='%s' (%d), priority=%u.", agent, nice_debug ("Agent %p : STUN-CC REQ to '%s:%u', socket=%u, pair=%s (c-id:%u), tie=%llu, username='%s' (%d), password='%s' (%d), priority=%u.", agent,
tmpbuf, tmpbuf,
ntohs(((struct sockaddr_in*)(&sockaddr))->sin_port), ntohs(nice_address_get_port (&pair->remote->addr)),
pair->local->sockptr->fileno, pair->local->sockptr->fileno,
pair->foundation, pair->component_id, pair->foundation, pair->component_id,
(unsigned long long)agent->tie_breaker, (unsigned long long)agent->tie_breaker,
......
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