-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix IceServer crash when client uses ICE renomination #1182
Conversation
Fixes #1176 ### Details - Problem was in this PR 756 that added support for ICE nomination. - Before that PR, we always assumed that if there is a tuple then we are in 'connected' or 'completed' state, so there is a selected ICE tuple. - That's no longer true when client uses ICE nomination stuff.
@penguinol could you please take a look to this? |
Maybe we do not need to remove |
I don't think so. In the original code, when HandleTuple() is called, we first assert that tuple is empty and later we check nomination, but the assertion already happened and there were tuples so it aborted the process. The thing here is that, before introducing renomination stuff, IceServer logic assumed that if there is any tuple then state was connected or completed and there was a selectedTuple. This is no longer true. With renomination it can happen that the first time we call to HandleTuple() the tuple is added to the list of tuples but selectedTuple remains unset and state remains new (or disconnected). So I have a question. Scenario:
Is this correct? Or should state change to connected and the tuple become the selectedTuple? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good 👍
According to https://webrtc.googlesource.com/src/+/refs/heads/main/p2p/base/connection.cc#1037 |
Co-authored-by: José Luis Millán <[email protected]>
Yes, but we cannot crash if client sends a STUN binding request with nomination 0. |
@jmillan commented in #756 (review) about those conditions in Those conditions are basically like this: case IceState::NEW:
{
if (!hasUseCandidate && !hasNomination)
{
// Store the tuple.
auto* storedTuple = AddTuple(tuple);
// Mark it as selected tuple.
SetSelectedTuple(storedTuple);
// Update state.
this->state = IceState::CONNECTED;
// Notify the listener.
this->listener->OnIceServerConnected(this);
}
else
{
// Store the tuple.
auto* storedTuple = AddTuple(tuple);
if ((hasNomination && nomination > this->remoteNomination) || !hasNomination)
{
// Mark it as selected tuple.
SetSelectedTuple(storedTuple);
// Update state.
this->state = IceState::COMPLETED;
// Update nomination.
if (hasNomination && nomination > this->remoteNomination)
{
this->remoteNomination = nomination;
}
// Notify the listener.
this->listener->OnIceServerCompleted(this);
}
}
break;
} @jmillan said:
But that's not true:
|
Totally true 👍 |
Fixes #1176
Details