Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 143221bb authored by Guillaume Jacquart's avatar Guillaume Jacquart
Browse files

Merge branch '5651-fix_stop_orbot_again' into 'main'

5651: fix stopping tor service cause random crashes.

See merge request !11
parents 303579d9 5458bd4a
Loading
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -6,7 +6,7 @@ buildscript {

    ext.kotlin_version = "1.6.10"
    ext.orbot_version = "orbot-16.6.2"
    ext.advanced_privacy_version = "1.3.0"
    ext.advanced_privacy_version = "1.6.0-dev"

    repositories {
        google()
+10 −2
Original line number Diff line number Diff line
@@ -239,9 +239,17 @@ class IpScramblerModule(private val context: Context): IIpScramblerModule {
            action = OrbotConstants.ACTION_STOP,
            extra = Bundle().apply { putBoolean(ACTION_STOP_FOREGROUND_TASK, true) }
        )
        stoppingWatchdog(5)
    }

    private fun stoppingWatchdog(countDown: Int) {
        Handler(Looper.getMainLooper()).postDelayed({
            requestStatus()
        }, 1000)
            if (isServiceRunning() && countDown > 0) {
                stoppingWatchdog(countDown - 1)
            } else {
                updateStatus(Status.OFF, force = true)
            }
        }, 500)
    }

    override fun requestStatus() {