Skip to content

Conversation

@wrangelvid
Copy link
Contributor

Description

Expose pion/ice's ContinualGatheringPolicy via the SettingEngine.

See #3321
I thought setting the gathering policy through the settings engine would be the best place for this as I am not aware of any w3c standard api.

@wrangelvid wrangelvid self-assigned this Dec 25, 2025
@wrangelvid wrangelvid requested a review from JoTurk December 25, 2025 21:55
@wrangelvid wrangelvid added this to the v4.3.0 milestone Dec 25, 2025
@wrangelvid wrangelvid linked an issue Dec 25, 2025 that may be closed by this pull request
@wrangelvid
Copy link
Contributor Author

@joeturki I know we said we would discuss the API in the issue, but this seemed so straightforward that I made a quick PR. I have no issues with completely rewriting this, but I thought it would aid the discussion to have a rough draft.

@codecov
Copy link

codecov bot commented Dec 25, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 85.04%. Comparing base (cbaff19) to head (58f18ba).

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #3323      +/-   ##
==========================================
+ Coverage   85.02%   85.04%   +0.01%     
==========================================
  Files          80       80              
  Lines        9512     9520       +8     
==========================================
+ Hits         8088     8096       +8     
- Misses       1001     1002       +1     
+ Partials      423      422       -1     
Flag Coverage Δ
go 85.04% <100.00%> (+0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Member

@JoTurk JoTurk left a comment

Choose a reason for hiding this comment

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

The problem is that this changes fundamental ICE behavior without defining the observable user contract. We agreed to add this to 4.3 but we need to define behavior.

If we just merge this we'll introduces undefined behavior (UB) around:

  1. OnICECandidate(nil)
    Today, many apps treat nil as terminal. Continual gathering breaks that assumption unless behavior is redefined. will we send nil after every iteration? will we not send nil at all? we need to define and test this.

  2. ICEGatheringState transitions becomes incoherent If the state reaches complete, but candidates can still appear later, the state machine lies. we don't define how the state will be in the peer. and we don't test it either.

so we have two assumptions either:

  1. the state must be allowed to transition back to gathering, or

  2. complete must be redefined under continual mode.

The PR does assert neither.

we will also need to add vnet tests around this similar to how we did with renomination.

@wrangelvid
Copy link
Contributor Author

That was quick, thank you Joe!
Semantically, I believe it makes to not send OnICECandidate(nil) and never change to complete since we never stop gathering. Since a user would have to explicitly opt-in via the settings engine, I believe this "breaking" change is fine as long as we document it well (which we don't currently).

Though, lets think about an alternative! We could also treat continual gathering as lots of mini ice-restarts. In that case it would make sense to do a bunch of state transitions and sending nil, but it needs change in pion/ice.

I am tending towards the first approach as it seems semantically more aligned.

Happy to add vnet tests!

@wrangelvid
Copy link
Contributor Author

@joeturki Added the vnet test. Ones AddIpToNic is merged, we can uncomment the test in this PR. Let me know what you think.

@JoTurk
Copy link
Member

JoTurk commented Jan 1, 2026

I commented on the transport PR 🙏

@wrangelvid wrangelvid force-pushed the continual_gathering branch from 657e133 to 3c656ef Compare January 9, 2026 04:00
@wrangelvid wrangelvid force-pushed the continual_gathering branch from 3c656ef to 58f18ba Compare January 9, 2026 04:02
@wrangelvid
Copy link
Contributor Author

@JoTurk vnet test enabled and ready for review.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

Support Continual Gathering

2 participants