Licode-ErizoClientIOS
Licode-ErizoClientIOS copied to clipboard
fix: do ECClient disconnect in RTCIceConnectionStateClosed only to prevent crash.
I found a bug that it crashes when I disconnect a room. The bug is described in the issue I sent earlier: https://github.com/zevarito/Licode-ErizoClientIOS/issues/74
I found the reason it crashes is that a block inside ECClient is being released when the ECClient is released(while ECRoom's publishingStatsTimer
released, and so that ECRoom and ECClient are released).
So I move the disconnect
to RTCIceConnectionStateClosed to prevent this crash.
And after I read the references addressed in this issue (https://github.com/zevarito/Licode-ErizoClientIOS/issues/73), I still didn't find the answer that should both RTCIceConnectionStateDisconnected
and RTCIceConnectionStateClosed
do disconnect
. Since disconnect deallocates ECRoom
, and it "probably" always calls RTCIceConnectionStateClosed
, we could safely call disconnect
at RTCIceConnectionStateClosed
.
And so far I couldn't reproduce the crash on your sample code yet. And also I didn't build WebRTC to get the debug symbol see the backtrace (although I guess it's irrelevant). I will try it later.
thanks @allenlinli! I'll hope to be back on this project next week and review/test all these.