mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-15 04:18:53 +01:00
Use the same maximum frame length for all transports.
This commit is contained in:
@@ -46,7 +46,7 @@ class BluetoothPlugin implements DuplexPlugin {
|
||||
private final Clock clock;
|
||||
private final SecureRandom secureRandom;
|
||||
private final DuplexPluginCallback callback;
|
||||
private final int maxFrameLength, maxLatency, pollingInterval;
|
||||
private final int maxLatency, pollingInterval;
|
||||
private final Semaphore discoverySemaphore = new Semaphore(1);
|
||||
|
||||
private volatile boolean running = false;
|
||||
@@ -54,13 +54,12 @@ class BluetoothPlugin implements DuplexPlugin {
|
||||
private volatile LocalDevice localDevice = null;
|
||||
|
||||
BluetoothPlugin(Executor ioExecutor, Clock clock, SecureRandom secureRandom,
|
||||
DuplexPluginCallback callback, int maxFrameLength, int maxLatency,
|
||||
DuplexPluginCallback callback, int maxLatency,
|
||||
int pollingInterval) {
|
||||
this.ioExecutor = ioExecutor;
|
||||
this.clock = clock;
|
||||
this.secureRandom = secureRandom;
|
||||
this.callback = callback;
|
||||
this.maxFrameLength = maxFrameLength;
|
||||
this.maxLatency = maxLatency;
|
||||
this.pollingInterval = pollingInterval;
|
||||
}
|
||||
@@ -69,10 +68,6 @@ class BluetoothPlugin implements DuplexPlugin {
|
||||
return ID;
|
||||
}
|
||||
|
||||
public int getMaxFrameLength() {
|
||||
return maxFrameLength;
|
||||
}
|
||||
|
||||
public int getMaxLatency() {
|
||||
return maxLatency;
|
||||
}
|
||||
|
||||
@@ -12,7 +12,6 @@ import org.briarproject.system.SystemClock;
|
||||
|
||||
public class BluetoothPluginFactory 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
|
||||
|
||||
@@ -33,6 +32,6 @@ public class BluetoothPluginFactory implements DuplexPluginFactory {
|
||||
|
||||
public DuplexPlugin createPlugin(DuplexPluginCallback callback) {
|
||||
return new BluetoothPlugin(ioExecutor, clock, secureRandom, callback,
|
||||
MAX_FRAME_LENGTH, MAX_LATENCY, POLLING_INTERVAL);
|
||||
MAX_LATENCY, POLLING_INTERVAL);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -39,10 +39,6 @@ class BluetoothTransportConnection implements DuplexTransportConnection {
|
||||
|
||||
private class Reader implements TransportConnectionReader {
|
||||
|
||||
public int getMaxFrameLength() {
|
||||
return plugin.getMaxFrameLength();
|
||||
}
|
||||
|
||||
public long getMaxLatency() {
|
||||
return plugin.getMaxLatency();
|
||||
}
|
||||
@@ -60,10 +56,6 @@ class BluetoothTransportConnection implements DuplexTransportConnection {
|
||||
|
||||
private class Writer implements TransportConnectionWriter {
|
||||
|
||||
public int getMaxFrameLength() {
|
||||
return plugin.getMaxFrameLength();
|
||||
}
|
||||
|
||||
public int getMaxLatency() {
|
||||
return plugin.getMaxLatency();
|
||||
}
|
||||
|
||||
@@ -29,8 +29,8 @@ implements RemovableDriveMonitor.Callback {
|
||||
|
||||
RemovableDrivePlugin(Executor ioExecutor, FileUtils fileUtils,
|
||||
SimplexPluginCallback callback, RemovableDriveFinder finder,
|
||||
RemovableDriveMonitor monitor, int maxFrameLength, int maxLatency) {
|
||||
super(ioExecutor, fileUtils, callback, maxFrameLength, maxLatency);
|
||||
RemovableDriveMonitor monitor, int maxLatency) {
|
||||
super(ioExecutor, fileUtils, callback, maxLatency);
|
||||
this.finder = finder;
|
||||
this.monitor = monitor;
|
||||
}
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
package org.briarproject.plugins.file;
|
||||
|
||||
import static org.briarproject.api.transport.TransportConstants.MAX_FRAME_LENGTH;
|
||||
|
||||
import java.util.concurrent.Executor;
|
||||
|
||||
import org.briarproject.api.TransportId;
|
||||
@@ -52,6 +50,6 @@ public class RemovableDrivePluginFactory implements SimplexPluginFactory {
|
||||
return null;
|
||||
}
|
||||
return new RemovableDrivePlugin(ioExecutor, fileUtils, callback,
|
||||
finder, monitor, MAX_FRAME_LENGTH, MAX_LATENCY);
|
||||
finder, monitor, MAX_LATENCY);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,17 +32,16 @@ class ModemPlugin implements DuplexPlugin, Modem.Callback {
|
||||
private final ModemFactory modemFactory;
|
||||
private final SerialPortList serialPortList;
|
||||
private final DuplexPluginCallback callback;
|
||||
private final int maxFrameLength, maxLatency;
|
||||
private final int maxLatency;
|
||||
|
||||
private volatile boolean running = false;
|
||||
private volatile Modem modem = null;
|
||||
|
||||
ModemPlugin(ModemFactory modemFactory, SerialPortList serialPortList,
|
||||
DuplexPluginCallback callback, int maxFrameLength, int maxLatency) {
|
||||
DuplexPluginCallback callback, int maxLatency) {
|
||||
this.modemFactory = modemFactory;
|
||||
this.serialPortList = serialPortList;
|
||||
this.callback = callback;
|
||||
this.maxFrameLength = maxFrameLength;
|
||||
this.maxLatency = maxLatency;
|
||||
}
|
||||
|
||||
@@ -50,10 +49,6 @@ class ModemPlugin implements DuplexPlugin, Modem.Callback {
|
||||
return ID;
|
||||
}
|
||||
|
||||
public int getMaxFrameLength() {
|
||||
return maxFrameLength;
|
||||
}
|
||||
|
||||
public int getMaxLatency() {
|
||||
return maxLatency;
|
||||
}
|
||||
@@ -199,10 +194,6 @@ class ModemPlugin implements DuplexPlugin, Modem.Callback {
|
||||
|
||||
private class Reader implements TransportConnectionReader {
|
||||
|
||||
public int getMaxFrameLength() {
|
||||
return maxFrameLength;
|
||||
}
|
||||
|
||||
public long getMaxLatency() {
|
||||
return maxLatency;
|
||||
}
|
||||
@@ -219,10 +210,6 @@ class ModemPlugin implements DuplexPlugin, Modem.Callback {
|
||||
|
||||
private class Writer implements TransportConnectionWriter {
|
||||
|
||||
public int getMaxFrameLength() {
|
||||
return getMaxFrameLength();
|
||||
}
|
||||
|
||||
public int getMaxLatency() {
|
||||
return getMaxLatency();
|
||||
}
|
||||
|
||||
@@ -11,7 +11,6 @@ import org.briarproject.util.StringUtils;
|
||||
|
||||
public class ModemPluginFactory implements DuplexPluginFactory {
|
||||
|
||||
private static final int MAX_FRAME_LENGTH = 1024;
|
||||
private static final int MAX_LATENCY = 30 * 1000; // 30 seconds
|
||||
|
||||
private final ModemFactory modemFactory;
|
||||
@@ -32,6 +31,6 @@ public class ModemPluginFactory implements DuplexPluginFactory {
|
||||
String enabled = callback.getConfig().get("enabled");
|
||||
if(StringUtils.isNullOrEmpty(enabled)) return null;
|
||||
return new ModemPlugin(modemFactory, serialPortList, callback,
|
||||
MAX_FRAME_LENGTH, MAX_LATENCY);
|
||||
MAX_LATENCY);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user