fix for binary version upgrade support

This commit is contained in:
Nathan Freitas 2014-04-07 23:35:58 -04:00
parent 4ed6ea1e9c
commit fc0554f9ff
2 changed files with 22 additions and 7 deletions

View File

@ -525,11 +525,27 @@ public class TorService extends Service implements TorServiceConstants, TorConst
fileXtables = new File(appBinHome, IPTABLES_ASSET_KEY); fileXtables = new File(appBinHome, IPTABLES_ASSET_KEY);
if (!fileTorRc.exists()) SharedPreferences prefs = getSharedPrefs(getApplicationContext());
String version = prefs.getString(PREF_BINARY_TOR_VERSION_INSTALLED,null);
if (version == null || (!version.equals(BINARY_TOR_VERSION)))
{ {
stopTor();
TorResourceInstaller installer = new TorResourceInstaller(this, appBinHome); TorResourceInstaller installer = new TorResourceInstaller(this, appBinHome);
boolean success = installer.installResources(); boolean success = installer.installResources();
prefs.edit().putString(PREF_BINARY_TOR_VERSION_INSTALLED,BINARY_TOR_VERSION).commit();
}
else if (!fileTorRc.exists())
{
stopTor();
TorResourceInstaller installer = new TorResourceInstaller(this, appBinHome);
boolean success = installer.installResources();
prefs.edit().putString(PREF_BINARY_TOR_VERSION_INSTALLED,BINARY_TOR_VERSION).commit();
} }
enableBinExec(fileTor); enableBinExec(fileTor);
@ -608,8 +624,9 @@ public class TorService extends Service implements TorServiceConstants, TorConst
if (mTransProxy == null) if (mTransProxy == null)
{ {
mTransProxy = new TorTransProxy(this); mTransProxy = new TorTransProxy(this, fileXtables);
mTransProxy.setXTables(fileXtables);
} }
logMessage ("Transparent Proxying: enabling..."); logMessage ("Transparent Proxying: enabling...");
@ -668,7 +685,7 @@ public class TorService extends Service implements TorServiceConstants, TorConst
logMessage ("Transparent Proxying: disabling..."); logMessage ("Transparent Proxying: disabling...");
if (mTransProxy == null) if (mTransProxy == null)
mTransProxy = new TorTransProxy(this); mTransProxy = new TorTransProxy(this, fileXtables);
mTransProxy.clearTransparentProxyingAll(this); mTransProxy.clearTransparentProxyingAll(this);
@ -1156,10 +1173,8 @@ public class TorService extends Service implements TorServiceConstants, TorConst
public IBinder onBind(Intent intent) { public IBinder onBind(Intent intent) {
_torInstance = this; _torInstance = this;
Thread thread = new Thread () Thread thread = new Thread ()
{ {

View File

@ -80,7 +80,7 @@ public interface TorServiceConstants {
public static final int DISABLE_TOR_MSG = 3; public static final int DISABLE_TOR_MSG = 3;
public static final int LOG_MSG = 4; public static final int LOG_MSG = 4;
public static final String BINARY_TOR_VERSION = "0.2.4.21"; public static final String BINARY_TOR_VERSION = "0.2.4.21-openssl1.0.1g";
public static final String BINARY_PRIVOXY_VERSION = "3.0.12"; public static final String BINARY_PRIVOXY_VERSION = "3.0.12";
public static final String PREF_BINARY_TOR_VERSION_INSTALLED = "BINARY_TOR_VERSION_INTALLED"; public static final String PREF_BINARY_TOR_VERSION_INSTALLED = "BINARY_TOR_VERSION_INTALLED";
public static final String PREF_BINARY_PRIVOXY_VERSION_INSTALLED = "BINARY_PRIVOXY_VERSION_INTALLED"; public static final String PREF_BINARY_PRIVOXY_VERSION_INSTALLED = "BINARY_PRIVOXY_VERSION_INTALLED";