fix: resolve network detection failure and ping-pong switching in mul…#570
Merged
Conversation
…ti-NIC scenario Two issues are fixed: 1. UB in HttpManager::get(url, timeoutSec): pass std::string to variadic function curl_easy_setopt instead of const char*, causing all HTTP requests to fail with "URL using bad/illegal format or missing URL". This made StatusChecker always report Limited and triggered the ping-pong switching loop. 2. Race condition in StatusChecker::realStartCheck(): when the check blocks for DNS timeout (~5s),InternetChecker may switch the primary connection in another thread. The stale result (based on old route) would incorrectly trigger network switching, creating a ping-pong loop between NICs. Fix: (1) use urlStd.c_str() in curl_easy_setopt; (2) snapshot the primary connection UUID before check and discard result if it changed. PMS:BUG-351163
caixr23
approved these changes
Jun 23, 2026
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: caixr23, ut003640 The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
Contributor
Author
|
/forcemerge |
Contributor
|
This pr force merged! (status: unstable) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
…ti-NIC scenario
Two issues are fixed:
UB in HttpManager::get(url, timeoutSec): pass std::string to variadic function curl_easy_setopt instead of const char*, causing all HTTP requests to fail with "URL using bad/illegal format or missing URL". This made StatusChecker always report Limited and triggered the ping-pong switching loop.
Race condition in StatusChecker::realStartCheck(): when the check blocks for DNS timeout (~5s),InternetChecker may switch the primary connection in another thread. The stale result (based on old route) would incorrectly trigger network switching, creating a ping-pong loop between NICs.
Fix: (1) use urlStd.c_str() in curl_easy_setopt; (2) snapshot the primary connection UUID before check and discard result if it changed.
PMS:BUG-351163