[tor-commits] [orbot/master] fix bridge/PT enable code based on bridge types

n8fr8 at torproject.org n8fr8 at torproject.org
Sun May 4 04:40:58 UTC 2014


commit 53673dae75b168cc555a01dc0e4f35ab9c6f1169
Author: Nathan Freitas <nathan at freitas.net>
Date:   Sun May 4 00:35:14 2014 -0400

    fix bridge/PT enable code based on bridge types
---
 src/org/torproject/android/TorConstants.java       |    2 +-
 src/org/torproject/android/service/TorService.java |   38 ++++++++++----------
 2 files changed, 21 insertions(+), 19 deletions(-)

diff --git a/src/org/torproject/android/TorConstants.java b/src/org/torproject/android/TorConstants.java
index 36cdf48..79ea7e0 100644
--- a/src/org/torproject/android/TorConstants.java
+++ b/src/org/torproject/android/TorConstants.java
@@ -32,7 +32,7 @@ public interface TorConstants {
 	public final static String PREF_BRIDGES_ENABLED = "pref_bridges_enabled";
 	public final static String PREF_BRIDGES_UPDATED = "pref_bridges_enabled";
 	public final static String PREF_BRIDGES_LIST = "pref_bridges_list";
-	public final static String PREF_BRIDGES_OBFUSCATED = "pref_bridges_obfuscated";
+	//public final static String PREF_BRIDGES_OBFUSCATED = "pref_bridges_obfuscated";
     public final static String PREF_OR = "pref_or";
     public final static String PREF_OR_PORT = "pref_or_port";
     public final static String PREF_OR_NICKNAME = "pref_or_nickname";
diff --git a/src/org/torproject/android/service/TorService.java b/src/org/torproject/android/service/TorService.java
index 13c653c..a54c3e2 100644
--- a/src/org/torproject/android/service/TorService.java
+++ b/src/org/torproject/android/service/TorService.java
@@ -1710,23 +1710,8 @@ public class TorService extends Service implements TorServiceConstants, TorConst
 		{
 		
 			logMessage ("Using bridges");
-			boolean obfsBridges = prefs.getBoolean(TorConstants.PREF_BRIDGES_OBFUSCATED, false);
 			String bridgeCfgKey = "Bridge";
 
-
-			if (obfsBridges)
-			{
-				String bridgeConfig = "obfs2,obfs3,scramblesuit exec " + fileObfsclient.getAbsolutePath();
-				
-				logMessage ("Using OBFUSCATED bridges: " + bridgeConfig);
-				
-				mBinder.updateConfiguration("ClientTransportPlugin",bridgeConfig, false);
-			}
-			else
-			{
-				logMessage ("Using standard bridges");
-			}
-			
 			String bridgeList = prefs.getString(TorConstants.PREF_BRIDGES_LIST,null);
 
 			if (bridgeList == null || bridgeList.length() == 0)
@@ -1738,6 +1723,7 @@ public class TorService extends Service implements TorServiceConstants, TorConst
 			
 				return false;
 			}
+
 			
 			String bridgeDelim = "\n";
 			
@@ -1747,9 +1733,7 @@ public class TorService extends Service implements TorServiceConstants, TorConst
 			}
 			
 			showToolbarNotification(getString(R.string.notification_using_bridges) + ": " + bridgeList, TRANSPROXY_NOTIFY_ID, R.drawable.ic_stat_tor, -1, false);
-
-						
-			  
+  
 			StringTokenizer st = new StringTokenizer(bridgeList,bridgeDelim);
 			while (st.hasMoreTokens())
 			{
@@ -1759,6 +1743,24 @@ public class TorService extends Service implements TorServiceConstants, TorConst
 
 			}
 
+			//check if any PT bridges are needed
+			boolean obfsBridges = bridgeList.contains("obfs2")||bridgeList.contains("obfs3")||bridgeList.contains("scramblesuit");
+
+			if (obfsBridges)
+			{
+				String bridgeConfig = "obfs2,obfs3,scramblesuit exec " + fileObfsclient.getAbsolutePath();
+				
+				logMessage ("Using OBFUSCATED bridges: " + bridgeConfig);
+				
+				mBinder.updateConfiguration("ClientTransportPlugin",bridgeConfig, false);
+			}
+			else
+			{
+				logMessage ("Using standard bridges");
+			}
+			
+
+
 			mBinder.updateConfiguration("UpdateBridgesFromAuthority", "0", false);
 			
 





More information about the tor-commits mailing list