perf(mobile): lower StopClient join timeout from 3s to 1s and log slow shutdown - #20
Merged
Merged
Conversation
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.
When the user taps Disconnect,
GooseRelayVpnService.stopVpn()waits up to 5 seconds (stopThread.join(5000L)) for Go'sStopClient()to return. InsideStopClient(), after the carriercancel()and SOCKS listener close, it waits another up to 3 seconds on<-clientDone. The inner 3s timeout is redundant with the outer 5s join.On a healthy disconnect where the carrier shuts down in <200ms (the common case), the user still sees ~3s of "DISCONNECTING" + 500ms fade ≈ 3.5s, where the inner 3s timeout is the sole contributor — the outer 5s never kicks in.
Change: Lower the inner
<-clientDonewait from3s → 1s. If the carrier takes longer than 1s, log it and return — the outer 5s join still caps total disconnect at a sane value. Healthy disconnect drops from ~3.5s → ~1.5s with no behavioral regression.The new
[client] carrier shutdown exceeded 1slog line surfaces slow shutdowns for debugging without changingStopClient's gomobile API surface (which would ripple to Kotlin callers).Files changed
mobile/mobile.go— single block replacement (+9/-1)CI gates to watch
go vet(Linux —syscall.Dupresolves; the Windows-only vet error indupFdis pre-existing, unrelated)bash ./android/build_go_mobile.sh)./gradlew :app:assembleDebug