Repository navigation
Conversation
When switching networks (e.g. Wi-Fi to cellular or vice-versa), outbound connections would stall because clearInterface() reset state.name to null, causing subsequent interface updates to evaluate changed as false. As a result, onDefaultInterfaceChanged was never invoked and proxy core connections remained bound to dead sockets. - Track initial reporting state per listener so handovers after a disconnect are recognized as network changes. - Avoid blocking the Looper callback thread on LinkProperties lookup and handle link property updates via onLinkPropertiesChanged. - Update underlying network state and notify VpnService unconditionally, safely clearing underlying networks when disconnected. - Add debounce to prevent connection reset storms during rapid signal flapping. - Add unit test verifying interface state transitions and handover resets.
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.
Summary
Fixes traffic stall when switching between Wi-Fi and mobile data on Android 15/16 (#114).
Root Cause
LinkPropertiesfor a newly acquired network can be null or empty during the initialonAvailable()callback. The previous logic returned early when interface name was unresolved, failing to reset outbound sockets.Thread.sleep(100)inside the network callback blocked the connectivity looper, delaying subsequent network capability and link property updates.Solution
hasReportedAtLeastOnceto reliably trigger reset when transitioning between active network interfaces.onLinkPropertiesChangedinDefaultNetworkListenerto handle asynchronous link updates cleanly.setUnderlyingNetworkswith API level check (API 29+) inVpnService.