Skip to content

Commit 3907f6a

Browse files
committed
tunnel: do not keep service running when bringing tunnel down
Doing so causes the process to restart when the activity is cleared, even when no tunnel is running. I fear this might also lead to the current flurry of DeadSystemExceptions. Signed-off-by: Jason A. Donenfeld <[email protected]>
1 parent 652971d commit 3907f6a

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

tunnel/src/main/java/com/wireguard/android/backend/GoBackend.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -324,6 +324,9 @@ private void setStateInternal(final Tunnel tunnel, @Nullable final Config config
324324
currentTunnelHandle = -1;
325325
currentConfig = null;
326326
wgTurnOff(handleToClose);
327+
try {
328+
vpnService.get(0, TimeUnit.NANOSECONDS).stopSelf();
329+
} catch (final TimeoutException ignored) { }
327330
}
328331

329332
tunnel.onStateChange(state);

0 commit comments

Comments
 (0)