Bug 819096: Fix for =/== confusion in trickle ICE r=abr
authorEKR <ekr@rtfm.com>
Thu, 06 Dec 2012 15:39:56 -0800
changeset 116296 6ab2a1b55394552f54e5e612ba21c0d147094e19
parent 116295 7963fe83e7a2837b5899a8c9b122f08bca01ca08
child 116297 483fe8d512a09862c96a9c4de47a72803c56bdd1
push id19831
push userrjesup@wgate.com
push dateMon, 17 Dec 2012 15:47:26 +0000
treeherdermozilla-inbound@6ab2a1b55394 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersabr
bugs819096
milestone20.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 819096: Fix for =/== confusion in trickle ICE r=abr
media/mtransport/third_party/nICEr/src/ice/ice_component.c
--- a/media/mtransport/third_party/nICEr/src/ice/ice_component.c
+++ b/media/mtransport/third_party/nICEr/src/ice/ice_component.c
@@ -546,28 +546,33 @@ int nr_ice_component_pair_candidates(nr_
     nr_ice_socket *isock;
     int r,_status;
     char codeword[5];
 
     r_log(LOG_ICE,LOG_DEBUG,"Pairing candidates======");
     /* Create the candidate pairs */
     lcand=TAILQ_FIRST(&lcomp->candidates);
     while(lcand){
+      int was_paired = 0;
+
       nr_ice_compute_codeword(lcand->label,strlen(lcand->label),codeword);
       r_log(LOG_ICE,LOG_DEBUG,"Examining local candidate %s:%s",codeword,lcand->label);
 
       switch(lcand->type){
         case HOST:
           break;
         case SERVER_REFLEXIVE:
           /* Don't actually pair these candidates */
           goto next_cand;
           break;
         case PEER_REFLEXIVE:
-          UNIMPLEMENTED;
+          /* This is not implemented, and I'm not sure if we need it
+             for trickle ICE. We don't need it for regular ICE */
+          assert(0);
+          ABORT(R_INTERNAL);
           break;
         case RELAYED:
           break;
         default:
           assert(0);
           ABORT(R_INTERNAL);
           break;
       }
@@ -581,42 +586,49 @@ int nr_ice_component_pair_candidates(nr_
       while(pcand){
         /* Only pair peer candidates which have not yet been paired.
            This allows "trickle ICE". (Not yet standardized, but
            part of WebRTC).
 
            TODO(ekr@rtfm.com): Add refernece to the spec when there
            is one.
          */
-        if (pcand->state = NR_ICE_CAND_PEER_CANDIDATE_UNPAIRED) {
+        if (pcand->state == NR_ICE_CAND_PEER_CANDIDATE_UNPAIRED) {
           nr_ice_compute_codeword(pcand->label,strlen(pcand->label),codeword);
           r_log(LOG_ICE,LOG_DEBUG,"Examining peer candidate %s:%s",codeword,pcand->label);
           
           if(r=nr_ice_candidate_pair_create(pctx,lcand,pcand,&pair))
             ABORT(r);
           
           if(r=nr_ice_candidate_pair_insert(&pcomp->stream->check_list,
               pair))
             ABORT(r);
         }
+        else {
+	  was_paired = 1;
+	}
         pcand=TAILQ_NEXT(pcand,entry_comp);
       }
-    
+
       if(!pair)
-        ABORT(R_INTERNAL);
+        goto next_cand;
 
-      /* Add the stun username/password pair from the last pair (any 
-         would do) to the stun contexts */
-      isock=STAILQ_FIRST(&lcomp->sockets);
-      while(isock){
-        if(r=nr_stun_server_add_client(isock->stun_server,pctx->label,
-           pair->r2l_user,&pair->r2l_pwd,nr_ice_component_stun_server_cb,pcomp))
-          ABORT(r);
+      if (!was_paired) {
+        /* Add the stun username/password pair from the last pair (any
+           would do) to the stun contexts, but only if we haven't already
+           done so (was_paired) */
+        isock=STAILQ_FIRST(&lcomp->sockets);
+        while(isock){
+          if(r=nr_stun_server_add_client(isock->stun_server,pctx->label,
+             pair->r2l_user,&pair->r2l_pwd,nr_ice_component_stun_server_cb,pcomp)) {
+             ABORT(r);
+          }
 
-        isock=STAILQ_NEXT(isock,entry);
+          isock=STAILQ_NEXT(isock,entry);
+        }
       }
 
     next_cand:
       lcand=TAILQ_NEXT(lcand,entry_comp);
     } 
 
     /* Mark all peer candidates as paired */
     pcand=TAILQ_FIRST(&pcomp->candidates);