Bug 831290 - Avoid double done_cb firing in nICEr r=abr
authorEKR <ekr@rtfm.com>
Sun, 03 Feb 2013 12:05:12 -0800
changeset 131342 f0422702a077b6e706c84499331a306717d78d61
parent 131341 4d3829e572e62fb051f03458dbf67b752af7b86f
child 131343 5835bc763be7603b7b4fb528460a2c3ac1d5534a
push id2323
push userbbajaj@mozilla.com
push dateMon, 01 Apr 2013 19:47:02 +0000
treeherdermozilla-beta@7712be144d91 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersabr
bugs831290
milestone21.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 831290 - Avoid double done_cb firing in nICEr r=abr
media/mtransport/third_party/nICEr/src/ice/ice_peer_ctx.c
media/mtransport/third_party/nICEr/src/ice/ice_peer_ctx.h
--- a/media/mtransport/third_party/nICEr/src/ice/ice_peer_ctx.c
+++ b/media/mtransport/third_party/nICEr/src/ice/ice_peer_ctx.c
@@ -448,22 +448,24 @@ int nr_ice_peer_ctx_stream_done(nr_ice_p
     }
 
     if(str)
       goto done;  /* Something isn't done */
 
     /* OK, we're finished, one way or another */
     r_log(LOG_ICE,LOG_INFO,"ICE-PEER(%s): all checks completed success=%d fail=%d",pctx->label,succeeded,failed);
 
-    /* Schedule a done notification
+    /* Schedule a done notification for the first done event.
        IMPORTANT: This is done in a callback because we expect destructors
        of various kinds to be fired from here */
-
-    assert(!pctx->done_cb_timer);
-    NR_ASYNC_TIMER_SET(0,nr_ice_peer_ctx_fire_done,pctx,&pctx->done_cb_timer);
+    if (!pctx->reported_done) {
+      pctx->reported_done = 1;
+      assert(!pctx->done_cb_timer);
+      NR_ASYNC_TIMER_SET(0,nr_ice_peer_ctx_fire_done,pctx,&pctx->done_cb_timer);
+    }
 
   done:
     _status=0;
 //  abort:
     return(_status);
   }
 
 
--- a/media/mtransport/third_party/nICEr/src/ice/ice_peer_ctx.h
+++ b/media/mtransport/third_party/nICEr/src/ice/ice_peer_ctx.h
@@ -52,16 +52,17 @@ struct nr_ice_peer_ctx_ {
   int peer_lite;
   int peer_ice_mismatch;
 
   nr_ice_media_stream_head peer_streams;
   int active_streams;
   int waiting_pairs;
 
   void *done_cb_timer;
+  UCHAR reported_done;
 
   STAILQ_ENTRY(nr_ice_peer_ctx_) entry;
 };
 
 typedef STAILQ_HEAD(nr_ice_peer_ctx_head_, nr_ice_peer_ctx_) nr_ice_peer_ctx_head;
 
 int nr_ice_peer_ctx_create(nr_ice_ctx *ctx, nr_ice_handler *handler,char *label, nr_ice_peer_ctx **pctxp);
 int nr_ice_peer_ctx_destroy(nr_ice_peer_ctx **pctxp);