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

If TURN bind request fails with "Stale nonce", retry with refreshed nonce #543

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

marcbrevoort-cyberhive
Copy link

If a channel bind (refresh) fails with a stale nonce error, the nonce should be refreshed and the attempt should be retried.

This seeks to fix #542

If a channel bind (refresh) fails with a stale nonce error, the nonce should be refreshed and the attempt should be retried.
@marcbrevoort-cyberhive marcbrevoort-cyberhive changed the title Update relay_conn.rs If bind request fails with "Stale nonce", retry with refreshed nonce Mar 7, 2024
@marcbrevoort-cyberhive marcbrevoort-cyberhive changed the title If bind request fails with "Stale nonce", retry with refreshed nonce If TURN bind request fails with "Stale nonce", retry with refreshed nonce Mar 7, 2024
Copy link
Member

@rainliu rainliu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

.

Copy link
Member

@rainliu rainliu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

make sure all tests are passed.

@marcbrevoort-cyberhive
Copy link
Author

marcbrevoort-cyberhive commented Mar 8, 2024

Okay, while this demonstrates what needs to happen, bind is actually an associated function rather than a method so it doesn't have access to self so the line

self.set_nonce_from_msg(&res);

throws an error.

Now, this line doesn't have to be run during the bind; it can also be excuted by the caller. To avoid confusion, instead of a TryAgain I could define a new error StaleNonce(Message) which allows communicating back the nonce to be set in an error.
However since the caller is itself an async block, it too doesn't have access to self (unless I move it into the block which of course causes all sorts of borrow checker complaints.

What needs to happen here is clear enough: if the channel bind fails with "stale nonce", it needs to be retried with a refreshed nonce, but at this point my knowledge of the webrtc source is insufficient to figure out how the missing re-bind can be added without upsetting the architecture of the crate, so I'll leave #542 open as a bug.

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.

If TURN channel is inactive, it times out and is never re-established
2 participants