Skip to content

Add sticky choice option for leastping#3621

Merged
xiaokangwang merged 1 commit intov2fly:masterfrom
xiaokangwang:dev-leastping-sticky-choice-fb5fxhf8lf9804gnrr4ikdv132ul9a96w5c3
Feb 15, 2026
Merged

Add sticky choice option for leastping#3621
xiaokangwang merged 1 commit intov2fly:masterfrom
xiaokangwang:dev-leastping-sticky-choice-fb5fxhf8lf9804gnrr4ikdv132ul9a96w5c3

Conversation

@xiaokangwang
Copy link
Contributor

(AI Generated Summary)
This pull request adds a new "sticky choice" feature to the StrategyLeastPingConfig load balancing strategy. This feature allows the strategy to remember and reuse the last selected outbound when enabled, potentially improving connection stability. The implementation introduces a new configuration field, updates the protobuf definitions and generated code, and modifies the strategy logic to support this behavior.

Sticky choice feature for least ping strategy:

  • Added a new sticky_choice boolean field to the StrategyLeastPingConfig protobuf message and regenerated the corresponding Go code to include this option. [1] [2] [3] [4]
  • Updated the LeastPingStrategy struct in strategy_leastping.go to include a mutex and a lastChoice field for thread-safe tracking of the last selected outbound. [1] [2]
  • Modified the PickOutbound method to reuse the last selected outbound if sticky_choice is enabled and no new outbound is selected, ensuring thread safety with locking.

@codecov
Copy link

codecov bot commented Feb 15, 2026

Codecov Report

❌ Patch coverage is 0% with 9 lines in your changes missing coverage. Please review.
✅ Project coverage is 23.17%. Comparing base (7fdb717) to head (abff2b3).
⚠️ Report is 9 commits behind head on master.

Files with missing lines Patch % Lines
app/router/strategy_leastping.go 0.00% 5 Missing ⚠️
app/router/config.pb.go 0.00% 4 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #3621      +/-   ##
==========================================
- Coverage   23.21%   23.17%   -0.04%     
==========================================
  Files         836      836              
  Lines       45454    45466      +12     
==========================================
- Hits        10552    10539      -13     
- Misses      33685    33707      +22     
- Partials     1217     1220       +3     

☔ 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.

@xiaokangwang xiaokangwang merged commit 02434ca into v2fly:master Feb 15, 2026
41 of 43 checks passed
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.

1 participant