Bug 1335966: skip refreshing ICE cosent for streams with no consent context. r?bwc draft
authorNils Ohlmeier [:drno] <drno@ohlmeier.org>
Wed, 01 Feb 2017 16:54:59 -0800
changeset 496967 057360c08f75cb5556d12943007ab3355e296955
parent 496768 a8d497b09753c91783b68c5805c64f34a2f39629
child 548771 86615b5f72474048a144d6a168182e53a337ccc4
push id48765
push userdrno@ohlmeier.org
push dateSat, 11 Mar 2017 01:20:16 +0000
reviewersbwc
bugs1335966
milestone55.0a1
Bug 1335966: skip refreshing ICE cosent for streams with no consent context. r?bwc MozReview-Commit-ID: 91aZIMdGBAQ
media/mtransport/third_party/nICEr/src/ice/ice_component.c
media/mtransport/third_party/nICEr/src/ice/ice_media_stream.c
--- a/media/mtransport/third_party/nICEr/src/ice/ice_component.c
+++ b/media/mtransport/third_party/nICEr/src/ice/ice_component.c
@@ -1354,16 +1354,20 @@ void nr_ice_component_consent_calc_conse
     comp->consent_ctx->maximum_transmits_timeout_ms = tval;
   }
 
 static void nr_ice_component_consent_timer_cb(NR_SOCKET s, int how, void *cb_arg)
   {
     nr_ice_component *comp=cb_arg;
     int r;
 
+    if (!comp->consent_ctx) {
+      return;
+    }
+
     if (comp->consent_timer) {
       NR_async_timer_cancel(comp->consent_timer);
     }
     comp->consent_timer = 0;
 
     comp->consent_ctx->params.ice_binding_request.username =
       comp->stream->l2r_user;
     comp->consent_ctx->params.ice_binding_request.password =
--- a/media/mtransport/third_party/nICEr/src/ice/ice_media_stream.c
+++ b/media/mtransport/third_party/nICEr/src/ice/ice_media_stream.c
@@ -587,36 +587,31 @@ int nr_ice_media_stream_set_state(nr_ice
 
 
 void nr_ice_media_stream_refresh_consent_all(nr_ice_media_stream *stream)
   {
     nr_ice_component *comp;
 
     comp=STAILQ_FIRST(&stream->components);
     while(comp){
-      if((comp->state != NR_ICE_COMPONENT_DISABLED) &&
-         (comp->local_component->state != NR_ICE_COMPONENT_DISABLED) &&
-          comp->disconnected) {
+      if(comp->disconnected) {
         nr_ice_component_refresh_consent_now(comp);
       }
 
       comp=STAILQ_NEXT(comp,entry);
     }
   }
 
 void nr_ice_media_stream_disconnect_all_components(nr_ice_media_stream *stream)
   {
     nr_ice_component *comp;
 
     comp=STAILQ_FIRST(&stream->components);
     while(comp){
-      if((comp->state != NR_ICE_COMPONENT_DISABLED) &&
-         (comp->local_component->state != NR_ICE_COMPONENT_DISABLED)) {
-        comp->disconnected = 1;
-      }
+      comp->disconnected = 1;
 
       comp=STAILQ_NEXT(comp,entry);
     }
   }
 
 void nr_ice_media_stream_set_disconnected(nr_ice_media_stream *stream, int disconnected)
   {
     if (stream->disconnected == disconnected) {
@@ -726,16 +721,19 @@ int nr_ice_media_stream_component_failed
     }
 
     /* Cancel our timer */
     if(stream->timer){
       NR_async_timer_cancel(stream->timer);
       stream->timer=0;
     }
 
+    /* Cancel consent timers in case it is running already */
+    nr_ice_component_consent_destroy(component);
+
     if (stream->pctx->handler) {
       stream->pctx->handler->vtbl->stream_failed(stream->pctx->handler->obj,stream->local_stream);
     }
 
     /* Now tell the peer_ctx that we're connected */
     if(r=nr_ice_peer_ctx_check_if_connected(stream->pctx))
       ABORT(r);