Skip to content
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: don't form new pairs for invalidated candidates #466

Merged
merged 2 commits into from
Feb 28, 2024

Conversation

thomaseizinger
Copy link
Collaborator

When a candidate gets invalidated, we don't want it to be used anymore. At the moment, str0m will form new pairs upon receiving a STUN request for an invalidated candidate. With the new pair being created, str0m will restart sending binding requests for this candidate pair.

@thomaseizinger
Copy link
Collaborator Author

I've stumbled over this because I am using invalidate_candidate to tell str0m that I no longer want certain candidate pairs being tested (i.e. relay pairs when I've found a direct connection).

Now, one could argue that the current behaviour is also correct because we are apparently still receiving messages on this candidate so it must be valid. If that is how it is meant to work, then we'll have to find another way of filtering this traffic by perhaps discarding it on the application layer and not feeding it to str0m. That feels a bit hacky though. I'd expect that calling invalidate_candidate will disable the candidate, even if we receive binding requests for it.

@algesten
Copy link
Owner

This took me down a rabbit hole. Reading the code it's not clear to me what the exact semantics of discarding a client is. I was wondering whether this change is correct, or whether the check should be in the let local_idx = … above.

I'm leaning towards that your change is correct – this leaves the candidate as known for incoming traffic (not triggering the STUN request for socket that is neither a host nor a relay candidate. expect).

@algesten algesten merged commit a16addd into algesten:main Feb 28, 2024
22 checks passed
@thomaseizinger
Copy link
Collaborator Author

This took me down a rabbit hole. Reading the code it's not clear to me what the exact semantics of discarding a client is. I was wondering whether this change is correct, or whether the check should be in the let local_idx = … above.

I'm leaning towards that your change is correct – this leaves the candidate as known for incoming traffic (not triggering the STUN request for socket that is neither a host nor a relay candidate. expect).

When reading the code, I noticed that discarded has a double meaning. It means both invalidated and redundant. Perhaps that can be clarified at some point by just not adding redundant candidates at all?

Also, the panic you are talking about is actually something that I think we should fix. I don't think we should put it on the application to sanitise these inputs. Instead, str0m should just discard the message I think.

@algesten
Copy link
Owner

Also, the panic you are talking about is actually something that I think we should fix. I don't think we should put it on the application to sanitise these inputs. Instead, str0m should just discard the message I think.

You might be right. Maybe raise that as a separate issue/PR?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants