Commit 338e5da
authored
perf(mobile): lower StopClient join timeout from 3s to 1s and log slow shutdown (#20)
When the user taps Disconnect, `GooseRelayVpnService.stopVpn()` waits up to **5 seconds** (`stopThread.join(5000L)`) for Go's `StopClient()` to return. Inside `StopClient()`, after the carrier `cancel()` 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 `<-clientDone` wait from `3s → 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 1s` log line surfaces slow shutdowns for debugging without changing `StopClient`'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.Dup` resolves; the Windows-only vet error in `dupFd` is pre-existing, unrelated)
- AAR build (`bash ./android/build_go_mobile.sh`)
- `./gradlew :app:assembleDebug`1 parent 2b0ba1b commit 338e5da
1 file changed
Lines changed: 9 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
239 | 239 | | |
240 | 240 | | |
241 | 241 | | |
242 | | - | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
243 | 251 | | |
244 | 252 | | |
245 | 253 | | |
| |||
0 commit comments