Skip to content

Commit

Permalink
Do not run vpn watchdog when in non-VPN mode
Browse files Browse the repository at this point in the history
  • Loading branch information
Ch4t4r committed Aug 20, 2021
1 parent a5ae877 commit 821c6eb
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1444,9 +1444,15 @@ class DnsVpnService : VpnService(), Runnable, CoroutineScope {
hideBadConnectionNotification()
}, logger = this@DnsVpnService.logger, advancedLogging = getPreferences().advancedLogging)
}
vpnWatchdog = VpnWatchDog({
showVpnRevokedNotification()
}, this)
vpnWatchdog = if (!runInNonVpnMode) {
vpnWatchdog?.stop()
VpnWatchDog({
showVpnRevokedNotification()
}, this)
} else {
vpnWatchdog?.stop()
null
}
}

private fun createQueryLogger(): QueryListener? {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import kotlinx.coroutines.*
* You can contact the developer at daniel.wolf@frostnerd.com.
*/
class VpnWatchDog(private val onVpnDisconnected:() -> Unit,
private val context: Context) {
context: Context) {
private val supervisor = SupervisorJob()
private val scope = CoroutineScope(supervisor + Dispatchers.IO)
private var running = true
Expand Down

0 comments on commit 821c6eb

Please sign in to comment.