ice
ice copied to clipboard
ICE Agent can not be restarted when gathering
In recent versions of the Unnamed SFU, the client will restart ICE whenever the connection's ICE state goes into failed. I'm occasionally getting the following error:
ICE Agent can not be restarted when gathering
It happens somewhere in the code that handles incoming offers; I'd need to add more detailed logging in order to know which exact function triggers the error. How do I avoid this problem?
@jech This is really just a deficiency of Pion/ice! I don’t think it is terribly hard to fix either.
I think it will just take a careful design concurrency wise.
Before that improvement lands you can just not allow a restart until the nil candidate has been emitted.
I've implemented a workaround (different than the one you suggest), so this is no longer urgent.
How the ICE Restart Should Work:
Right now the Restart method in agent.go attempts to restart ICE gathering, but if that agent's gatheringstate == GatheringStateGathering, the Restart method returns.
Instead, the Restart method should cancel the gathering processes running in gather.go by running a.gatherCandidateCancle() like here in gather.go, and then proceed to restart the gathering process.
Let me know if that sounds good!
@Sean-Der what happend to that pull request?