Add gatheringTimeoutAfterHost option#23
Conversation
Add "gatheringTimeoutAfterHost" option. The existing gatheringTimeout option serves a similar purpose, with a subtle distinction: - gatheringTimeout forces ICE gathering to stop after a fixed amount of time, even if no candidates have been found. - gatheringTimeoutAfterHost waits until at least one host candidate has been found before starting the timer. The timer logic was spread all over the place, I also deduplicated the logic and put the relevant logic in two helper functions.
10ab440 to
1491023
Compare
|
@ibc Could you review and merge this PR? |
| REGEXP_NORMALIZED_CANDIDATE: new RegExp(/^candidate:/i), | ||
| REGEXP_FIX_CANDIDATE: new RegExp(/(^a=|\r|\n)/gi), | ||
| REGEXP_RELAY_CANDIDATE: new RegExp(/ relay /i), | ||
| REGEXP_HOST_CANDIDATE: / typ host/i, |
There was a problem hiding this comment.
May you follow the same syntax here?
There was a problem hiding this comment.
I can do that.
Why do you use the RegExp constructor in the first place?
There was a problem hiding this comment.
I would accept the faster solution regardless which one it is. I expected that creating a RegExp instance is the same as creating a literal regexp.
There was a problem hiding this comment.
The literal regexp already returns a RegExp instance. So what you're doing is basically taking a RegExp and constructing a new instance of it - 2 instances in total.
I'll update the PR with a commit that removes all unnecessary RegExp constructions.
|
Sorry for the late response. Honestly, I think we should avoid custom API. Both |
`/pattern/flags` already results in a RegExp instance, there is no point in using `new RegExp(/pattern/flags)`.
|
@ibc Done, thanks for the review! |
Add "gatheringTimeoutAfterHost" option. The existing gatheringTimeout option serves a similar purpose, with a subtle distinction:
The timer logic was spread all over the place, I also deduplicated the logic and put the relevant logic in two helper functions.