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

[tor-commits] [orbot/master] ensure settings are updated and binary paths are on service restart



commit 6e6546972a6adedb72a90333eb9fe12ab87aa41f
Author: Nathan Freitas <nathan@xxxxxxxxxxx>
Date:   Tue Aug 26 23:01:46 2014 -0400

    ensure settings are updated and binary paths are on service restart
---
 src/org/torproject/android/service/TorService.java |   43 +++++++++++++-------
 1 file changed, 28 insertions(+), 15 deletions(-)

diff --git a/src/org/torproject/android/service/TorService.java b/src/org/torproject/android/service/TorService.java
index af41960..8a43dba 100644
--- a/src/org/torproject/android/service/TorService.java
+++ b/src/org/torproject/android/service/TorService.java
@@ -340,6 +340,12 @@ public class TorService extends Service implements TorServiceConstants, TorConst
 
 		try
 		{
+
+			if (fileTor == null)
+				initBinariesAndDirectories();
+			
+			updateSettings ();
+
 			mExecutor.execute (new TorStarter(intent));
 			
 		    return Service.START_STICKY;
@@ -568,6 +574,24 @@ public class TorService extends Service implements TorServiceConstants, TorConst
 		try
 		{
 			initBinariesAndDirectories();
+			updateSettings();
+		
+			new Thread(new Runnable ()
+			{
+				public void run ()
+				{
+					try
+			    	{
+			    		findExistingProc ();
+			    	}
+			    	catch (Exception e)
+			    	{
+			    		Log.e(TAG,"error onBind",e);
+			    	}
+		        	
+				}
+			}).start();
+		
 		}
 		catch (Exception e)
 		{
@@ -576,21 +600,6 @@ public class TorService extends Service implements TorServiceConstants, TorConst
 			logNotice("There was an error installing Orbot binaries");
 		}
 		
-		new Thread(new Runnable ()
-    	{
-    		public void run ()
-    		{
-    			try
-    	    	{
-    	    		findExistingProc ();
-    	    	}
-    	    	catch (Exception e)
-    	    	{
-    	    		Log.e(TAG,"error onBind",e);
-    	    	}
-            	
-    		}
-    	}).start();
     	
 	}
 
@@ -712,6 +721,7 @@ public class TorService extends Service implements TorServiceConstants, TorConst
     
     private void updateSettings () throws TimeoutException, IOException
     {
+    	
 		SharedPreferences prefs = TorServiceUtils.getSharedPrefs(getApplicationContext());
 
     	mHasRoot = prefs.getBoolean(PREF_HAS_ROOT,false);
@@ -736,6 +746,9 @@ public class TorService extends Service implements TorServiceConstants, TorConst
     	
 		currentStatus = STATUS_CONNECTING;
     	
+		if (fileTor == null)
+			initBinariesAndDirectories();
+		
     	enableBinExec(fileTor);
 		enableBinExec(filePolipo);	
 		enableBinExec(fileObfsclient);



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