mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-13 19:29:06 +01:00
Use the same maximum frame length for all transports.
This commit is contained in:
@@ -69,7 +69,7 @@ class DroidtoothPlugin implements DuplexPlugin {
|
||||
private final SecureRandom secureRandom;
|
||||
private final Clock clock;
|
||||
private final DuplexPluginCallback callback;
|
||||
private final int maxFrameLength, maxLatency, pollingInterval;
|
||||
private final int maxLatency, pollingInterval;
|
||||
|
||||
private volatile boolean running = false;
|
||||
private volatile boolean wasDisabled = false;
|
||||
@@ -81,7 +81,7 @@ class DroidtoothPlugin implements DuplexPlugin {
|
||||
|
||||
DroidtoothPlugin(Executor ioExecutor, AndroidExecutor androidExecutor,
|
||||
Context appContext, SecureRandom secureRandom, Clock clock,
|
||||
DuplexPluginCallback callback, int maxFrameLength, int maxLatency,
|
||||
DuplexPluginCallback callback, int maxLatency,
|
||||
int pollingInterval) {
|
||||
this.ioExecutor = ioExecutor;
|
||||
this.androidExecutor = androidExecutor;
|
||||
@@ -89,7 +89,6 @@ class DroidtoothPlugin implements DuplexPlugin {
|
||||
this.secureRandom = secureRandom;
|
||||
this.clock = clock;
|
||||
this.callback = callback;
|
||||
this.maxFrameLength = maxFrameLength;
|
||||
this.maxLatency = maxLatency;
|
||||
this.pollingInterval = pollingInterval;
|
||||
}
|
||||
@@ -98,10 +97,6 @@ class DroidtoothPlugin implements DuplexPlugin {
|
||||
return ID;
|
||||
}
|
||||
|
||||
public int getMaxFrameLength() {
|
||||
return maxFrameLength;
|
||||
}
|
||||
|
||||
public int getMaxLatency() {
|
||||
return maxLatency;
|
||||
}
|
||||
|
||||
@@ -15,7 +15,6 @@ import android.content.Context;
|
||||
|
||||
public class DroidtoothPluginFactory implements DuplexPluginFactory {
|
||||
|
||||
private static final int MAX_FRAME_LENGTH = 1024;
|
||||
private static final int MAX_LATENCY = 30 * 1000; // 30 seconds
|
||||
private static final int POLLING_INTERVAL = 3 * 60 * 1000; // 3 minutes
|
||||
|
||||
@@ -41,7 +40,6 @@ public class DroidtoothPluginFactory implements DuplexPluginFactory {
|
||||
|
||||
public DuplexPlugin createPlugin(DuplexPluginCallback callback) {
|
||||
return new DroidtoothPlugin(ioExecutor, androidExecutor, appContext,
|
||||
secureRandom, clock, callback, MAX_FRAME_LENGTH, MAX_LATENCY,
|
||||
POLLING_INTERVAL);
|
||||
secureRandom, clock, callback, MAX_LATENCY, POLLING_INTERVAL);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -39,10 +39,6 @@ class DroidtoothTransportConnection implements DuplexTransportConnection {
|
||||
|
||||
private class Reader implements TransportConnectionReader {
|
||||
|
||||
public int getMaxFrameLength() {
|
||||
return plugin.getMaxFrameLength();
|
||||
}
|
||||
|
||||
public long getMaxLatency() {
|
||||
return plugin.getMaxLatency();
|
||||
}
|
||||
@@ -60,10 +56,6 @@ class DroidtoothTransportConnection implements DuplexTransportConnection {
|
||||
|
||||
private class Writer implements TransportConnectionWriter {
|
||||
|
||||
public int getMaxFrameLength() {
|
||||
return plugin.getMaxFrameLength();
|
||||
}
|
||||
|
||||
public int getMaxLatency() {
|
||||
return plugin.getMaxLatency();
|
||||
}
|
||||
|
||||
@@ -26,10 +26,9 @@ class AndroidLanTcpPlugin extends LanTcpPlugin {
|
||||
private volatile BroadcastReceiver networkStateReceiver = null;
|
||||
|
||||
AndroidLanTcpPlugin(Executor ioExecutor, Context appContext,
|
||||
DuplexPluginCallback callback, int maxFrameLength, int maxLatency,
|
||||
DuplexPluginCallback callback, int maxLatency,
|
||||
int maxIdleTime, int pollingInterval) {
|
||||
super(ioExecutor, callback, maxFrameLength, maxLatency, maxIdleTime,
|
||||
pollingInterval);
|
||||
super(ioExecutor, callback, maxLatency, maxIdleTime, pollingInterval);
|
||||
this.appContext = appContext;
|
||||
}
|
||||
|
||||
|
||||
@@ -11,7 +11,6 @@ import android.content.Context;
|
||||
|
||||
public class AndroidLanTcpPluginFactory implements DuplexPluginFactory {
|
||||
|
||||
private static final int MAX_FRAME_LENGTH = 1024;
|
||||
private static final int MAX_LATENCY = 30 * 1000; // 30 seconds
|
||||
private static final int MAX_IDLE_TIME = 30 * 1000; // 30 seconds
|
||||
private static final int POLLING_INTERVAL = 3 * 60 * 1000; // 3 minutes
|
||||
@@ -30,6 +29,6 @@ public class AndroidLanTcpPluginFactory implements DuplexPluginFactory {
|
||||
|
||||
public DuplexPlugin createPlugin(DuplexPluginCallback callback) {
|
||||
return new AndroidLanTcpPlugin(ioExecutor, appContext, callback,
|
||||
MAX_FRAME_LENGTH, MAX_LATENCY, MAX_IDLE_TIME, POLLING_INTERVAL);
|
||||
MAX_LATENCY, MAX_IDLE_TIME, POLLING_INTERVAL);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -75,8 +75,7 @@ class TorPlugin implements DuplexPlugin, EventHandler {
|
||||
private final Context appContext;
|
||||
private final LocationUtils locationUtils;
|
||||
private final DuplexPluginCallback callback;
|
||||
private final int maxFrameLength, maxLatency, maxIdleTime, pollingInterval;
|
||||
private final int socketTimeout;
|
||||
private final int maxLatency, maxIdleTime, pollingInterval, socketTimeout;
|
||||
private final File torDirectory, torFile, geoIpFile, configFile, doneFile;
|
||||
private final File cookieFile, hostnameFile;
|
||||
private final AtomicBoolean circuitBuilt;
|
||||
@@ -90,13 +89,11 @@ class TorPlugin implements DuplexPlugin, EventHandler {
|
||||
|
||||
TorPlugin(Executor ioExecutor, Context appContext,
|
||||
LocationUtils locationUtils, DuplexPluginCallback callback,
|
||||
int maxFrameLength, int maxLatency, int maxIdleTime,
|
||||
int pollingInterval) {
|
||||
int maxLatency, int maxIdleTime, int pollingInterval) {
|
||||
this.ioExecutor = ioExecutor;
|
||||
this.appContext = appContext;
|
||||
this.locationUtils = locationUtils;
|
||||
this.callback = callback;
|
||||
this.maxFrameLength = maxFrameLength;
|
||||
this.maxLatency = maxLatency;
|
||||
this.maxIdleTime = maxIdleTime;
|
||||
this.pollingInterval = pollingInterval;
|
||||
@@ -117,10 +114,6 @@ class TorPlugin implements DuplexPlugin, EventHandler {
|
||||
return ID;
|
||||
}
|
||||
|
||||
public int getMaxFrameLength() {
|
||||
return maxFrameLength;
|
||||
}
|
||||
|
||||
public int getMaxLatency() {
|
||||
return maxLatency;
|
||||
}
|
||||
|
||||
@@ -17,7 +17,6 @@ public class TorPluginFactory implements DuplexPluginFactory {
|
||||
private static final Logger LOG =
|
||||
Logger.getLogger(TorPluginFactory.class.getName());
|
||||
|
||||
private static final int MAX_FRAME_LENGTH = 1024;
|
||||
private static final int MAX_LATENCY = 30 * 1000; // 30 seconds
|
||||
private static final int MAX_IDLE_TIME = 30 * 1000; // 30 seconds
|
||||
private static final int POLLING_INTERVAL = 3 * 60 * 1000; // 3 minutes
|
||||
@@ -44,6 +43,6 @@ public class TorPluginFactory implements DuplexPluginFactory {
|
||||
return null;
|
||||
}
|
||||
return new TorPlugin(ioExecutor,appContext, locationUtils, callback,
|
||||
MAX_FRAME_LENGTH, MAX_LATENCY, MAX_IDLE_TIME, POLLING_INTERVAL);
|
||||
MAX_LATENCY, MAX_IDLE_TIME, POLLING_INTERVAL);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -38,10 +38,6 @@ class TorTransportConnection implements DuplexTransportConnection {
|
||||
|
||||
private class Reader implements TransportConnectionReader {
|
||||
|
||||
public int getMaxFrameLength() {
|
||||
return plugin.getMaxFrameLength();
|
||||
}
|
||||
|
||||
public long getMaxLatency() {
|
||||
return plugin.getMaxLatency();
|
||||
}
|
||||
@@ -59,10 +55,6 @@ class TorTransportConnection implements DuplexTransportConnection {
|
||||
|
||||
private class Writer implements TransportConnectionWriter {
|
||||
|
||||
public int getMaxFrameLength() {
|
||||
return plugin.getMaxFrameLength();
|
||||
}
|
||||
|
||||
public int getMaxLatency() {
|
||||
return plugin.getMaxLatency();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user