Moved CPU architecture check from Tor plugin to plugin factory.

This allows us to avoid instantiating the plugin on unsupported
architectures.
This commit is contained in:
akwizgran
2013-12-19 23:23:41 +00:00
parent 676ef9518b
commit bd566fdb8f
2 changed files with 3 additions and 6 deletions

View File

@@ -113,12 +113,6 @@ class TorPlugin implements DuplexPlugin, EventHandler {
}
public boolean start() throws IOException {
// Check that we have a Tor binary for this architecture
if(!Build.CPU_ABI.startsWith("armeabi")) {
if(LOG.isLoggable(INFO))
LOG.info("No Tor binary for this architecture");
return false;
}
// Try to connect to an existing Tor process if there is one
try {
controlSocket = new Socket("127.0.0.1", CONTROL_PORT);

View File

@@ -8,6 +8,7 @@ import net.sf.briar.api.plugins.duplex.DuplexPlugin;
import net.sf.briar.api.plugins.duplex.DuplexPluginCallback;
import net.sf.briar.api.plugins.duplex.DuplexPluginFactory;
import android.content.Context;
import android.os.Build;
public class TorPluginFactory implements DuplexPluginFactory {
@@ -31,6 +32,8 @@ public class TorPluginFactory implements DuplexPluginFactory {
}
public DuplexPlugin createPlugin(DuplexPluginCallback callback) {
// Check that we have a Tor binary for this architecture
if(!Build.CPU_ABI.startsWith("armeabi")) return null;
return new TorPlugin(pluginExecutor,appContext, shutdownManager,
callback, MAX_FRAME_LENGTH, MAX_LATENCY, POLLING_INTERVAL);
}