Commit 44173747 authored by Simon Morlat's avatar Simon Morlat

fix bug with turn/ice

parent f6e55b27
......@@ -2300,11 +2300,13 @@ static bool_t ice_handle_received_turn_allocate_success_response(IceCheckList *c
candidate = ice_add_local_candidate(cl, "srflx", ms_stun_family_to_af(srflx_addr.family), srflx_addr_str, srflx_port, componentID, candidate);
ms_stun_address_to_printable_ip_address(&srflx_addr, srflx_addr_str, sizeof(srflx_addr_str));
ms_message("ice: Add candidate obtained by STUN/TURN: %s:srflx", srflx_addr_str);
ms_stun_address_to_ip_address(&relay_addr, relay_addr_str, sizeof(relay_addr_str), &relay_port);
if (cl->session->turn_enabled) {
request->turn_context->stats.nb_successful_allocate++;
ice_schedule_turn_allocation_refresh(cl, componentID, ms_stun_message_get_lifetime(msg));
}
if (relay_addr.family != 0){
ms_stun_address_to_ip_address(&relay_addr, relay_addr_str, sizeof(relay_addr_str), &relay_port);
if (relay_port != 0) {
if (cl->session->turn_enabled) {
ms_turn_context_set_allocated_relay_addr(request->turn_context, relay_addr);
......@@ -2315,6 +2317,7 @@ static bool_t ice_handle_received_turn_allocate_success_response(IceCheckList *c
}
}
}
}
request->responded = TRUE;
if (cl->session->turn_enabled) {
ms_turn_context_set_state(request->turn_context, MS_TURN_CONTEXT_STATE_ALLOCATION_CREATED);
......
......@@ -585,8 +585,10 @@ MSStunAddress ms_ip_address_to_stun_address(int ai_family, int socktype, const c
MSStunAddress stun_addr;
struct addrinfo *res = bctbx_ip_address_to_addrinfo(ai_family, socktype, hostname, port);
memset(&stun_addr, 0, sizeof(stun_addr));
if (res){
ms_sockaddr_to_stun_address(res->ai_addr, &stun_addr);
bctbx_freeaddrinfo(res);
}
return stun_addr;
}
......
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