Bug 1293457: stop printing gathering results on shutdown. r=mjf
MozReview-Commit-ID: LubRuNsaHBZ
--- a/media/mtransport/test/ice_unittest.cpp
+++ b/media/mtransport/test/ice_unittest.cpp
@@ -385,16 +385,17 @@ class IceTestPeer : public sigslot::has_
bool offerer,
bool allow_loopback = false, bool enable_tcp = true,
bool allow_link_local = false, bool hide_non_default = false) :
name_(name),
ice_ctx_(NrIceCtxHandler::Create(name, offerer, allow_loopback,
enable_tcp, allow_link_local,
hide_non_default)),
candidates_(),
+ shutting_down_(false),
gathering_complete_(false),
ready_ct_(0),
ice_complete_(false),
ice_reached_checking_(false),
received_(0),
sent_(0),
fake_resolver_(),
dns_resolver_(new NrIceResolver()),
@@ -965,16 +966,17 @@ class IceTestPeer : public sigslot::has_
void Close() {
test_utils_->sts_target()->Dispatch(
WrapRunnable(ice_ctx_->ctx(), &NrIceCtx::destroy_peer_ctx),
NS_DISPATCH_SYNC);
}
void Shutdown() {
std::cerr << name_ << " Shutdown" << std::endl;
+ shutting_down_ = true;
for (auto s = controlled_trickle_candidates_.begin();
s != controlled_trickle_candidates_.end();
++s) {
for (auto cand = s->second.begin(); cand != s->second.end(); ++cand) {
delete *cand;
}
}
@@ -999,17 +1001,19 @@ class IceTestPeer : public sigslot::has_
WrapRunnableRet(&res, ice_ctx_->ctx(), &NrIceCtx::StartChecks),
NS_DISPATCH_SYNC);
ASSERT_TRUE(NS_SUCCEEDED(res));
}
// Handle events
void GatheringStateChange(NrIceCtx* ctx,
NrIceCtx::GatheringState state) {
- (void)ctx;
+ if (shutting_down_) {
+ return;
+ }
if (state != NrIceCtx::ICE_CTX_GATHER_COMPLETE) {
return;
}
std::cerr << name_ << " Gathering complete" << std::endl;
gathering_complete_ = true;
std::cerr << name_ << " CANDIDATES:" << std::endl;
@@ -1394,16 +1398,17 @@ class IceTestPeer : public sigslot::has_
private:
std::string name_;
RefPtr<NrIceCtxHandler> ice_ctx_;
std::map<std::string, std::vector<std::string> > candidates_;
// Maps from stream id to list of remote trickle candidates
std::map<size_t, std::vector<SchedulableTrickleCandidate*> >
controlled_trickle_candidates_;
+ bool shutting_down_;
bool gathering_complete_;
int ready_ct_;
bool ice_complete_;
bool ice_reached_checking_;
size_t received_;
size_t sent_;
struct timeval consent_timestamp_;
NrIceResolverFake fake_resolver_;