Bug 1149298 - Part 2: When destroying a candidate, ensure that the ice_ctx doesn't continue waiting for it to init. r=drno

--HG--
extra : rebase_source : a6b549f6f6bb133af4d39a4c8870b4eedab65c8a
This commit is contained in:
Byron Campen [:bwc] 2015-03-30 15:22:28 -07:00
Родитель 3ff500ee41
Коммит f940cd6f59
3 изменённых файлов: 17 добавлений и 9 удалений

Просмотреть файл

@ -540,11 +540,12 @@ NrIceCtx::SetStream(size_t index, NrIceMediaStream* stream) {
streams_.resize(index + 1);
}
if (streams_[index]) {
streams_[index]->Close();
}
RefPtr<NrIceMediaStream> oldStream(streams_[index]);
streams_[index] = stream;
if (oldStream) {
oldStream->Close();
}
}
std::string NrIceCtx::ufrag() const {

Просмотреть файл

@ -259,6 +259,13 @@ int nr_ice_candidate_destroy(nr_ice_candidate **candp)
cand=*candp;
if (cand->state == NR_ICE_CAND_STATE_INITIALIZING) {
/* Make sure the ICE ctx isn't still waiting around for this candidate
* to init. */
cand->state=NR_ICE_CAND_STATE_FAILED;
cand->done_cb(0,0,cand->cb_arg);
}
switch(cand->type){
case HOST:
break;

Просмотреть файл

@ -405,6 +405,11 @@ static void nr_ice_ctx_destroy_cb(NR_SOCKET s, int how, void *cb_arg)
int i;
nr_ice_stun_id *id1,*id2;
STAILQ_FOREACH_SAFE(s1, &ctx->streams, entry, s2){
STAILQ_REMOVE(&ctx->streams,s1,nr_ice_media_stream_,entry);
nr_ice_media_stream_destroy(&s1);
}
RFREE(ctx->label);
RFREE(ctx->stun_servers);
@ -426,11 +431,6 @@ static void nr_ice_ctx_destroy_cb(NR_SOCKET s, int how, void *cb_arg)
RFREE(ctx->pwd);
RFREE(ctx->ufrag);
STAILQ_FOREACH_SAFE(s1, &ctx->streams, entry, s2){
STAILQ_REMOVE(&ctx->streams,s1,nr_ice_media_stream_,entry);
nr_ice_media_stream_destroy(&s1);
}
STAILQ_FOREACH_SAFE(id1, &ctx->ids, entry, id2){
STAILQ_REMOVE(&ctx->ids,id1,nr_ice_stun_id_,entry);
RFREE(id1);