WIP: conncheck: implement more strictly nomination change with tcp candidates
This patch fixes a couple of places where the agent may be in aggressive nomination mode, with the controlling role, and having to deal with TCP (remote) candidates. It implements section 8 of RFC 6544, "Concluding ICE Processing" stating that the agent must use the regular selection algorithm when there are TCP candidates for a media stream.
Previously, only addition of new remote candidates were tested for this constraint, and eventually, the nomination mode was promoted to regular.
This same test must also be done when a TCP peer reflexive remote candidate is discovered. Since TCP local candidates remain alive, they can receive inbound stun request with this transport.
And a similar decision must be done when the agent role switches from controlled to controlling. We may end up with an agent that already had collected TCP remote candidates, due to its previous aggressive controlled status.
The conditions to accept the nomination switch is also a bit modified:
- we must be in state < connected (because in state connected, we may have already nominated pairs obtained in aggressive mode, that would break the regular nomination criterion selection)
- and with zero ongoing stun requests
These conditions can be relaxed in case of the role conflict resolution because (2) is not a problem, the inflight stun transaction have the use-candidate unset, since the previous role was controlled, and (1) is always verified: we couldn't conclude a mutual successfull stun exchange before resolving a role conflict.