Signal when the candidate list changes
If I understand correctly, currently there's no way for the outside code to know when a candidate is discarded or re-enabled.
Creating and maintaining an IO resource (e.g. UdpSocket) is costly, especially when one has to create one per candidate pair, and there's no reason to keep it alive if the associated pair was rejected. It would be nice to have additional events like PairAdded, PairRejected to add/remove those when neccessary.
This feature seems to be relatively easy to add. I'll try adding it, but would appreciate any tips and help.
My first thought is that it sounds simple enough.
However on second thought, we have what we can think of as a constant trickle ice.
A candidate might not be used initially but given changes in network adding more remote candidates, it might suddenly be chosen.
So the question is what this new event should communicate more than "not in use right now".
if the associated pair was rejected
Rejected or not nominated? Those are different things. If you want to reduce the number of IO resources, why are you creating more UDP sockets to begin with?
We just create one that listens on the wildcard address and then use STUN to figure out our address for the candidates. Why would you create more than one UDP socket?