Skip to content

Commit 3877ce6

Browse files
committed
perf(mobile): lower StopClient join timeout from 3s to 1s and log slow shutdown
1 parent 2b0ba1b commit 3877ce6

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

mobile/mobile.go

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,15 @@ func StopClient() {
239239
if done != nil {
240240
select {
241241
case <-done:
242-
case <-time.After(3 * time.Second):
242+
case <-time.After(1 * time.Second):
243+
// The carrier shutdown took longer than 1s. The outer
244+
// Android caller (GooseRelayVpnService.stopVpn) caps total
245+
// disconnect with a 5s outer join, so we return promptly
246+
// here and let the outer caller decide whether to log a
247+
// "stop timed out" message. StopTun/StopTunBridge below are
248+
// idempotent and safe to call even if the carrier is still
249+
// winding down.
250+
log.Printf("[client] carrier shutdown exceeded 1s, proceeding with TUN teardown")
243251
}
244252
}
245253

0 commit comments

Comments
 (0)