summaryrefslogtreecommitdiff
path: root/app/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'app/src/main')
-rw-r--r--app/src/main/java/se/leap/bitmaskclient/tor/TorServiceCommand.java6
1 files changed, 5 insertions, 1 deletions
diff --git a/app/src/main/java/se/leap/bitmaskclient/tor/TorServiceCommand.java b/app/src/main/java/se/leap/bitmaskclient/tor/TorServiceCommand.java
index 0f721013..b99abb3d 100644
--- a/app/src/main/java/se/leap/bitmaskclient/tor/TorServiceCommand.java
+++ b/app/src/main/java/se/leap/bitmaskclient/tor/TorServiceCommand.java
@@ -81,7 +81,8 @@ public class TorServiceCommand {
@WorkerThread
public static void stopTorService(Context context) {
- if (TorStatusObservable.getStatus() == TorStatusObservable.TorStatus.OFF) {
+ if (TorStatusObservable.getStatus() == TorStatusObservable.TorStatus.STOPPING ||
+ TorStatusObservable.getStatus() == TorStatusObservable.TorStatus.OFF) {
return;
}
TorStatusObservable.markCancelled();
@@ -102,6 +103,9 @@ public class TorServiceCommand {
}
public static void stopTorServiceAsync(Context context) {
+ if (!TorStatusObservable.isRunning()) {
+ return;
+ }
TorStatusObservable.markCancelled();
new Thread(() -> stopTorService(context)).start();
}