-
-
Notifications
You must be signed in to change notification settings - Fork 974
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
Timeout trigger _iceComplete if candidates seen. #353
Conversation
Includes patch: feross/simple-peer#353
So basically a timeout on ice gathering when My only issue would be that ice candidates coming in after the timeout won't be exchanged with the remote peer. But I guess if you want to exchange candidates after an offer, you should use trickle. LGTM. Great analysis too. |
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.
We don't usually commit the build until a release.
On some networks the iceStateChange=complete will not fire until the browser times out adding tens of seconds of latency even though all valid candidates have been recieved. This patch makes _iceComplete fire early and current offer return after some timeout if we've received valid candidates. See webtorrent/bittorrent-tracker#199 for further discussion.
56a1016
to
b97979d
Compare
@t-mullen thanks for your review! I've update the PR to remove the build artifact. |
@feross needed. |
Timeout trigger _iceComplete if candidates seen.
On some networks the
iceStateChange=complete
event will not fire until the browser times out, even though all valid and useful offer/answer candidates have already been gathered in the first milliseconds.Examples of this occurring:
According to a Chromium developer here:
In other words, on these networks there are valid routes to the internet but also invalid routes. Those invalid routes are confusing the offer gathering process into thinking it must keep trying.
This means that people on such networks can have 10s of seconds of delay in WebRTC offer creation time (consistently ~40s on my own network which experiences this issue) even though all valid candidates they are going to receive have been received in the first milliseconds of the offer process. The log in the bittorrent-tracker issue has a detailed example of this happening.
In the thread above Chromium developers suggest a JS time-out:
Similar patches have been suggested and implemented in other WebRTC projects:
This patch follows the same pattern and makes _iceComplete fire early and return the valid offers that have been gathered after some timeout. This only happens once the first valid candidate has been received. The timeout defaults to 5 seconds and can be modified by the user using
opts.iceCompleteTimeout
.Let me know if you need any further information or if there are any changes required to this patch. Thanks for your consideration!
Side note which may be of interest. On the network where I see the 45s delay the following simple-peer tests also fail: