[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [orbot/master] make sure tor network is re-enabled when user tries to restart



commit ff61d66bcfbb65baa7673857d420670c4f220c8c
Author: Nathan Freitas <nathan@xxxxxxxxxxx>
Date:   Wed Nov 16 07:52:21 2016 -0500

    make sure tor network is re-enabled when user tries to restart
---
 .../org/torproject/android/service/TorService.java | 27 ++++++++++------------
 1 file changed, 12 insertions(+), 15 deletions(-)

diff --git a/orbotservice/src/main/java/org/torproject/android/service/TorService.java b/orbotservice/src/main/java/org/torproject/android/service/TorService.java
index d55e1cf..53dd07a 100644
--- a/orbotservice/src/main/java/org/torproject/android/service/TorService.java
+++ b/orbotservice/src/main/java/org/torproject/android/service/TorService.java
@@ -581,14 +581,13 @@ public class TorService extends Service implements TorServiceConstants, OrbotCon
 
             if (mNotificationManager == null)
             {
-               
-               IntentFilter mNetworkStateFilter = new IntentFilter(ConnectivityManager.CONNECTIVITY_ACTION);               
-                registerReceiver(mNetworkStateReceiver , mNetworkStateFilter);
-         
                 mNotificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
-             
             }
-        
+
+            IntentFilter mNetworkStateFilter = new IntentFilter(ConnectivityManager.CONNECTIVITY_ACTION);
+            registerReceiver(mNetworkStateReceiver , mNetworkStateFilter);
+
+
             new Thread(new Runnable ()
             {
                 public void run ()
@@ -773,7 +772,8 @@ public class TorService extends Service implements TorServiceConstants, OrbotCon
         } else if (mCurrentStatus == STATUS_ON) {
         
             sendCallbackLogMessage("Ignoring start request, already started.");
-            
+            setTorNetworkEnabled (true);
+
             return;
         }        
         
@@ -1521,7 +1521,7 @@ public class TorService extends Service implements TorServiceConstants, OrbotCon
             mNetworkType = newNetType;
         	mConnectivity = newConnectivityState;
         	
-            if (doNetworKSleep)
+            if (doNetworKSleep && mCurrentStatus != STATUS_OFF)
             {
 	            setTorNetworkEnabled (mConnectivity);
 	            
@@ -1539,18 +1539,15 @@ public class TorService extends Service implements TorServiceConstants, OrbotCon
 
                 try {
 
-                    if (mCurrentStatus != STATUS_OFF)
+                    if (mConnectivity)
                     {
-                        if (mConnectivity)
+                        if (Prefs.useRoot() && Prefs.useTransparentProxying() && Prefs.transProxyNetworkRefresh())
                         {
-                            if (Prefs.useRoot() && Prefs.useTransparentProxying() && Prefs.transProxyNetworkRefresh())
-                            {
 
 
-                                disableTransparentProxy();
-                                enableTransparentProxy();
+                            disableTransparentProxy();
+                            enableTransparentProxy();
 
-                            }
                         }
                     }
 



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits