From 0728a708d8a4d7abc9cb28a0c19a8856b3b285d4 Mon Sep 17 00:00:00 2001 From: cyBerta Date: Thu, 11 Nov 2021 23:30:32 +0100 Subject: Check if snowflake stopped with an error. Change state to OFF in that case, too --- .../java/se/leap/bitmaskclient/tor/TorStatusObservable.java | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'app/src/main/java/se/leap') diff --git a/app/src/main/java/se/leap/bitmaskclient/tor/TorStatusObservable.java b/app/src/main/java/se/leap/bitmaskclient/tor/TorStatusObservable.java index d426d51e..cde17c34 100644 --- a/app/src/main/java/se/leap/bitmaskclient/tor/TorStatusObservable.java +++ b/app/src/main/java/se/leap/bitmaskclient/tor/TorStatusObservable.java @@ -1,13 +1,10 @@ package se.leap.bitmaskclient.tor; import android.content.Context; -import android.content.Intent; import android.util.Log; import androidx.annotation.Nullable; -import org.torproject.jni.TorService; - import java.util.Observable; import java.util.Observer; import java.util.Vector; @@ -45,7 +42,9 @@ public class TorStatusObservable extends Observable { public static final String LOG_TAG_TOR = "[TOR]"; public static final String LOG_TAG_SNOWFLAKE = "[SNOWFLAKE]"; public static final String SNOWFLAKE_STARTED = "--- Starting Snowflake Client ---"; - public static final String SNOWFLAKE_STOPPED = "---- SnowflakeConn: end collecting snowflakes ---"; + public static final String SNOWFLAKE_STOPPED_COLLECTING = "---- SnowflakeConn: end collecting snowflakes ---"; + public static final String SNOWFLAKE_COPY_LOOP_STOPPED = "copy loop ended"; + public static final String SNOWFLAKE_SOCKS_ERROR = "SOCKS accept error"; private static TorStatusObservable instance; private TorStatus status = TorStatus.OFF; @@ -117,7 +116,9 @@ public class TorStatusObservable extends Observable { if (SNOWFLAKE_STARTED.equals(message.trim())) { Log.d(TAG, "snowflakeStatus ON"); getInstance().snowflakeStatus = SnowflakeStatus.ON; - } else if (SNOWFLAKE_STOPPED.equals(message.trim())) { + } else if (SNOWFLAKE_STOPPED_COLLECTING.equals(message.trim()) || + SNOWFLAKE_COPY_LOOP_STOPPED.equals(message.trim()) || + message.trim().contains(SNOWFLAKE_SOCKS_ERROR)) { Log.d(TAG, "snowflakeStatus OFF"); getInstance().snowflakeStatus = SnowflakeStatus.OFF; } -- cgit v1.2.3