Bug 1224845 - close sockets on errors and don't connect to IPv4 TURN TCP from IPv6 sockets. r=jesup

This commit is contained in:
Nils Ohlmeier [:drno] 2016-01-28 10:53:56 -08:00
parent 79e271901d
commit 12cddca025
2 changed files with 11 additions and 0 deletions

View File

@ -359,6 +359,9 @@ void NrSocket::OnSocketReady(PRFileDesc *fd, int16_t outflags) {
fire_callback(NR_ASYNC_WAIT_READ); fire_callback(NR_ASYNC_WAIT_READ);
if (outflags & PR_POLL_WRITE & poll_flags()) if (outflags & PR_POLL_WRITE & poll_flags())
fire_callback(NR_ASYNC_WAIT_WRITE); fire_callback(NR_ASYNC_WAIT_WRITE);
if (outflags & (PR_POLL_ERR | PR_POLL_NVAL | PR_POLL_HUP))
// TODO: Bug 946423: how do we notify the upper layers about this?
close();
} }
void NrSocket::OnSocketDetached(PRFileDesc *fd) { void NrSocket::OnSocketDetached(PRFileDesc *fd) {

View File

@ -490,6 +490,14 @@ static int nr_ice_component_initialize_tcp(struct nr_ice_ctx_ *ctx,nr_ice_compon
if (ctx->turn_servers[j].turn_server.transport != IPPROTO_TCP) if (ctx->turn_servers[j].turn_server.transport != IPPROTO_TCP)
continue; continue;
if (ctx->turn_servers[j].turn_server.type == NR_ICE_STUN_SERVER_TYPE_ADDR &&
nr_transport_addr_cmp(&ctx->turn_servers[j].turn_server.u.addr,
&addrs[i].addr,
NR_TRANSPORT_ADDR_CMP_MODE_VERSION)) {
r_log(LOG_ICE,LOG_INFO,"ICE(%s): Skipping TURN server because of IP version mis-match (%u - %u)",ctx->label,addrs[i].addr.ip_version,ctx->turn_servers[j].turn_server.u.addr.ip_version);
continue;
}
if (!ice_tcp_disabled) { if (!ice_tcp_disabled) {
/* Use TURN server to get srflx candidates */ /* Use TURN server to get srflx candidates */
if(r=nr_ice_candidate_create(ctx,component, if(r=nr_ice_candidate_create(ctx,component,