Bug 1252777: skip over ICE TCP host candidate creation failures. r=bwc
authorNils Ohlmeier [:drno] <drno@ohlmeier.org>
Wed, 02 Mar 2016 01:27:01 -0800
changeset 286871 d2e86ab855bd0b14f381e4505627310c915dd79c
parent 286870 d0c4157a7fc6d74975b44864e489afb292845751
child 286872 bca82ee20a78bcb93c0ae72885e461ded33fbcb0
push id30056
push userryanvm@gmail.com
push dateSun, 06 Mar 2016 00:19:57 +0000
treeherderautoland@fcd55efa0672 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbwc
bugs1252777
milestone47.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1252777: skip over ICE TCP host candidate creation failures. r=bwc MozReview-Commit-ID: 6l0ierHz5eL
media/mtransport/nr_socket_prsock.cpp
media/mtransport/third_party/nICEr/src/ice/ice_component.c
--- a/media/mtransport/nr_socket_prsock.cpp
+++ b/media/mtransport/nr_socket_prsock.cpp
@@ -1875,22 +1875,20 @@ int NrTcpSocketIpc::read(void* buf, size
     *len = consumed_len;
   }
 
  abort:
   return _status;
 }
 
 int NrTcpSocketIpc::listen(int backlog) {
-  MOZ_ASSERT(false);
   return R_INTERNAL;
 }
 
 int NrTcpSocketIpc::accept(nr_transport_addr *addrp, nr_socket **sockp) {
-  MOZ_ASSERT(false);
   return R_INTERNAL;
 }
 
 void NrTcpSocketIpc::connect_i(const nsACString &remote_addr,
                                uint16_t remote_port,
                                const nsACString &local_addr,
                                uint16_t local_port) {
   ASSERT_ON_THREAD(io_thread_);
--- a/media/mtransport/third_party/nICEr/src/ice/ice_component.c
+++ b/media/mtransport/third_party/nICEr/src/ice/ice_component.c
@@ -440,45 +440,50 @@ static int nr_ice_component_initialize_t
       }
       else if(suppress) {
           continue;
       }
 
       if (!ice_tcp_disabled) {
         /* passive host candidate */
         if ((r=nr_ice_component_create_tcp_host_candidate(ctx, component, &addrs[i].addr,
-          TCP_TYPE_PASSIVE, backlog, 0, lufrag, pwd, &isock_psv)))
-          ABORT(r);
+          TCP_TYPE_PASSIVE, backlog, 0, lufrag, pwd, &isock_psv))) {
+          r_log(LOG_ICE,LOG_WARNING,"ICE(%s): failed to create passive TCP host candidate: %d",ctx->label,r);
+        }
 
         /* active host candidate */
         if ((r=nr_ice_component_create_tcp_host_candidate(ctx, component, &addrs[i].addr,
-          TCP_TYPE_ACTIVE, 0, 0, lufrag, pwd, NULL)))
-          ABORT(r);
+          TCP_TYPE_ACTIVE, 0, 0, lufrag, pwd, NULL))) {
+          r_log(LOG_ICE,LOG_WARNING,"ICE(%s): failed to create active TCP host candidate: %d",ctx->label,r);
+        }
 
         /* simultaneous-open host candidate */
         if (so_sock_ct) {
           if ((r=nr_ice_component_create_tcp_host_candidate(ctx, component, &addrs[i].addr,
-            TCP_TYPE_SO, 0, so_sock_ct, lufrag, pwd, &isock_so)))
-            ABORT(r);
+            TCP_TYPE_SO, 0, so_sock_ct, lufrag, pwd, &isock_so))) {
+            r_log(LOG_ICE,LOG_WARNING,"ICE(%s): failed to create simultanous open TCP host candidate: %d",ctx->label,r);
+          }
         }
 
         /* And srvrflx candidates for each STUN server */
         for(j=0;j<ctx->stun_server_ct;j++){
           if (ctx->stun_servers[j].transport!=IPPROTO_TCP)
             continue;
 
-          if(r=nr_ice_candidate_create(ctx,component,
-            isock_psv,isock_psv->sock,SERVER_REFLEXIVE,TCP_TYPE_PASSIVE,
-            &ctx->stun_servers[j],component->component_id,&cand))
-            ABORT(r);
-          TAILQ_INSERT_TAIL(&component->candidates,cand,entry_comp);
-          component->candidate_ct++;
-          cand=0;
+          if (isock_psv) {
+            if(r=nr_ice_candidate_create(ctx,component,
+              isock_psv,isock_psv->sock,SERVER_REFLEXIVE,TCP_TYPE_PASSIVE,
+              &ctx->stun_servers[j],component->component_id,&cand))
+              ABORT(r);
+            TAILQ_INSERT_TAIL(&component->candidates,cand,entry_comp);
+            component->candidate_ct++;
+            cand=0;
+          }
 
-          if (so_sock_ct) {
+          if (isock_so) {
             if(r=nr_ice_candidate_create(ctx,component,
               isock_so,isock_so->sock,SERVER_REFLEXIVE,TCP_TYPE_SO,
               &ctx->stun_servers[j],component->component_id,&cand))
               ABORT(r);
             TAILQ_INSERT_TAIL(&component->candidates,cand,entry_comp);
             component->candidate_ct++;
             cand=0;
           }
@@ -503,25 +508,27 @@ static int nr_ice_component_initialize_t
                                   &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) {
           /* Use TURN server to get srflx candidates */
-          if(r=nr_ice_candidate_create(ctx,component,
-            isock_psv,isock_psv->sock,SERVER_REFLEXIVE,TCP_TYPE_PASSIVE,
-            &ctx->turn_servers[j].turn_server,component->component_id,&cand))
-            ABORT(r);
-          TAILQ_INSERT_TAIL(&component->candidates,cand,entry_comp);
-          component->candidate_ct++;
-          cand=0;
+          if (isock_psv) {
+            if(r=nr_ice_candidate_create(ctx,component,
+              isock_psv,isock_psv->sock,SERVER_REFLEXIVE,TCP_TYPE_PASSIVE,
+              &ctx->turn_servers[j].turn_server,component->component_id,&cand))
+              ABORT(r);
+            TAILQ_INSERT_TAIL(&component->candidates,cand,entry_comp);
+            component->candidate_ct++;
+            cand=0;
+          }
 
-          if (so_sock_ct) {
+          if (isock_so) {
             if(r=nr_ice_candidate_create(ctx,component,
               isock_so,isock_so->sock,SERVER_REFLEXIVE,TCP_TYPE_SO,
               &ctx->turn_servers[j].turn_server,component->component_id,&cand))
               ABORT(r);
             TAILQ_INSERT_TAIL(&component->candidates,cand,entry_comp);
             component->candidate_ct++;
             cand=0;
           }
@@ -534,25 +541,25 @@ static int nr_ice_component_initialize_t
         if ((r=nr_transport_addr_fmt_addr_string(&addr)))
           ABORT(r);
         /* Create a local socket */
         if((r=nr_socket_factory_create_socket(ctx->socket_factory,&addr,&local_sock))){
           r_log(LOG_ICE,LOG_DEBUG,"ICE(%s): couldn't create socket for address %s",ctx->label,addr.as_string);
           continue;
         }
 
-        r_log(LOG_ICE,LOG_DEBUG,"nr_ice_component_initialize_tcp create");
+        r_log(LOG_ICE,LOG_DEBUG,"nr_ice_component_initialize_tcp creating TURN TCP wrappers");
 
         if (ctx->turn_tcp_socket_wrapper) {
-          /* Wrap it */
+          /* The HTTP proxy socket */
           if((r=nr_socket_wrapper_factory_wrap(ctx->turn_tcp_socket_wrapper, local_sock, &local_sock)))
             ABORT(r);
         }
 
-        /* Wrap it */
+        /* The TCP buffered socket */
         if((r=nr_socket_buffered_stun_create(local_sock, NR_STUN_MAX_MESSAGE_SIZE, TURN_TCP_FRAMING, &buffered_sock)))
           ABORT(r);
 
         /* The TURN socket */
         if(r=nr_socket_turn_create(buffered_sock, &turn_sock))
           ABORT(r);
 
         /* Create an ICE socket */