Add support for aggressive nomination in controlling agent #73
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
RFC 5245 requires data to be only sent on selected pair. Hence, there is aggressive nomination that includes UseCandidate flag in every connectivity check to speedup connection establishment time.
RFC 8445 removes aggressive nomination and assumes that data can be sent on any valid pair i.e. pair for, which a connectivity check without UseCandidate flag passes.
So far, we have been relying on RFC 8445. However, some implementaitons still require a pair to be nominated by the controlling side before they can start sending data. In our case, pair nomination happens when we finish gathering local candidates, eoc flag is set and checklist has been finished. Overall, this might take even 10 seconds. Such situation happens when connecting with Pion or Firefox.
To mitigate this issue we can either set eoc flag manually (the other side might not always send such indication and our eoc timeout is pretty high) or use aggresive nomination.
This PR adds support for aggressive nomination when we are the controlling side, preserving also the old mode. Agressive nomination is turned on by default as that's how all browsers work anyway.
It also aims to compute candidate and pair priorities correctly as they are crucial for aggressive nomination to work predictable.
IMPORTANT
There are two edge-case where aggressive nomination will fail.
The first one, see: https://bugzilla.mozilla.org/show_bug.cgi?id=1954423
The second one, when we receive binding request from remote host candidate that we treat as prflx as it has not been trickled yet. This will result in pairs with different priorities on both sides.