mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-17 21:29:54 +01:00
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:
@@ -113,12 +113,6 @@ class TorPlugin implements DuplexPlugin, EventHandler {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean start() throws IOException {
|
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 to connect to an existing Tor process if there is one
|
||||||
try {
|
try {
|
||||||
controlSocket = new Socket("127.0.0.1", CONTROL_PORT);
|
controlSocket = new Socket("127.0.0.1", CONTROL_PORT);
|
||||||
|
|||||||
@@ -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.DuplexPluginCallback;
|
||||||
import net.sf.briar.api.plugins.duplex.DuplexPluginFactory;
|
import net.sf.briar.api.plugins.duplex.DuplexPluginFactory;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
import android.os.Build;
|
||||||
|
|
||||||
public class TorPluginFactory implements DuplexPluginFactory {
|
public class TorPluginFactory implements DuplexPluginFactory {
|
||||||
|
|
||||||
@@ -31,6 +32,8 @@ public class TorPluginFactory implements DuplexPluginFactory {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public DuplexPlugin createPlugin(DuplexPluginCallback callback) {
|
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,
|
return new TorPlugin(pluginExecutor,appContext, shutdownManager,
|
||||||
callback, MAX_FRAME_LENGTH, MAX_LATENCY, POLLING_INTERVAL);
|
callback, MAX_FRAME_LENGTH, MAX_LATENCY, POLLING_INTERVAL);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user