mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-15 04:18:53 +01:00
Check periodically for retransmittable packets. Bug #46.
This commit is contained in:
@@ -69,8 +69,7 @@ class DroidtoothPlugin implements DuplexPlugin {
|
||||
private final SecureRandom secureRandom;
|
||||
private final Clock clock;
|
||||
private final DuplexPluginCallback callback;
|
||||
private final int maxFrameLength;
|
||||
private final long maxLatency, pollingInterval;
|
||||
private final int maxFrameLength, maxLatency, pollingInterval;
|
||||
|
||||
private volatile boolean running = false;
|
||||
private volatile boolean wasDisabled = false;
|
||||
@@ -82,8 +81,8 @@ class DroidtoothPlugin implements DuplexPlugin {
|
||||
|
||||
DroidtoothPlugin(Executor ioExecutor, AndroidExecutor androidExecutor,
|
||||
Context appContext, SecureRandom secureRandom, Clock clock,
|
||||
DuplexPluginCallback callback, int maxFrameLength, long maxLatency,
|
||||
long pollingInterval) {
|
||||
DuplexPluginCallback callback, int maxFrameLength, int maxLatency,
|
||||
int pollingInterval) {
|
||||
this.ioExecutor = ioExecutor;
|
||||
this.androidExecutor = androidExecutor;
|
||||
this.appContext = appContext;
|
||||
@@ -103,13 +102,13 @@ class DroidtoothPlugin implements DuplexPlugin {
|
||||
return maxFrameLength;
|
||||
}
|
||||
|
||||
public long getMaxLatency() {
|
||||
public int getMaxLatency() {
|
||||
return maxLatency;
|
||||
}
|
||||
|
||||
public long getMaxIdleTime() {
|
||||
public int getMaxIdleTime() {
|
||||
// Bluetooth detects dead connections so we don't need keepalives
|
||||
return Long.MAX_VALUE;
|
||||
return Integer.MAX_VALUE;
|
||||
}
|
||||
|
||||
public boolean start() throws IOException {
|
||||
@@ -245,7 +244,7 @@ class DroidtoothPlugin implements DuplexPlugin {
|
||||
return true;
|
||||
}
|
||||
|
||||
public long getPollingInterval() {
|
||||
public int getPollingInterval() {
|
||||
return pollingInterval;
|
||||
}
|
||||
|
||||
|
||||
@@ -16,8 +16,8 @@ import android.content.Context;
|
||||
public class DroidtoothPluginFactory implements DuplexPluginFactory {
|
||||
|
||||
private static final int MAX_FRAME_LENGTH = 1024;
|
||||
private static final long MAX_LATENCY = 60 * 1000; // 1 minute
|
||||
private static final long POLLING_INTERVAL = 3 * 60 * 1000; // 3 minutes
|
||||
private static final int MAX_LATENCY = 30 * 1000; // 30 seconds
|
||||
private static final int POLLING_INTERVAL = 3 * 60 * 1000; // 3 minutes
|
||||
|
||||
private final Executor ioExecutor;
|
||||
private final AndroidExecutor androidExecutor;
|
||||
|
||||
@@ -64,11 +64,11 @@ class DroidtoothTransportConnection implements DuplexTransportConnection {
|
||||
return plugin.getMaxFrameLength();
|
||||
}
|
||||
|
||||
public long getMaxLatency() {
|
||||
public int getMaxLatency() {
|
||||
return plugin.getMaxLatency();
|
||||
}
|
||||
|
||||
public long getMaxIdleTime() {
|
||||
public int getMaxIdleTime() {
|
||||
return plugin.getMaxIdleTime();
|
||||
}
|
||||
|
||||
|
||||
@@ -26,8 +26,8 @@ class AndroidLanTcpPlugin extends LanTcpPlugin {
|
||||
private volatile BroadcastReceiver networkStateReceiver = null;
|
||||
|
||||
AndroidLanTcpPlugin(Executor ioExecutor, Context appContext,
|
||||
DuplexPluginCallback callback, int maxFrameLength, long maxLatency,
|
||||
long maxIdleTime, long pollingInterval) {
|
||||
DuplexPluginCallback callback, int maxFrameLength, int maxLatency,
|
||||
int maxIdleTime, int pollingInterval) {
|
||||
super(ioExecutor, callback, maxFrameLength, maxLatency, maxIdleTime,
|
||||
pollingInterval);
|
||||
this.appContext = appContext;
|
||||
|
||||
@@ -12,9 +12,9 @@ import android.content.Context;
|
||||
public class AndroidLanTcpPluginFactory implements DuplexPluginFactory {
|
||||
|
||||
private static final int MAX_FRAME_LENGTH = 1024;
|
||||
private static final long MAX_LATENCY = 60 * 1000; // 1 minute
|
||||
private static final long MAX_IDLE_TIME = 30 * 1000; // 30 seconds
|
||||
private static final long POLLING_INTERVAL = 60 * 1000; // 1 minute
|
||||
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
|
||||
|
||||
private final Executor ioExecutor;
|
||||
private final Context appContext;
|
||||
|
||||
@@ -75,8 +75,8 @@ class TorPlugin implements DuplexPlugin, EventHandler {
|
||||
private final Context appContext;
|
||||
private final LocationUtils locationUtils;
|
||||
private final DuplexPluginCallback callback;
|
||||
private final int maxFrameLength, socketTimeout;
|
||||
private final long maxLatency, maxIdleTime, pollingInterval;
|
||||
private final int maxFrameLength, maxLatency, maxIdleTime, pollingInterval;
|
||||
private final int socketTimeout;
|
||||
private final File torDirectory, torFile, geoIpFile, configFile, doneFile;
|
||||
private final File cookieFile, hostnameFile;
|
||||
private final AtomicBoolean circuitBuilt;
|
||||
@@ -90,8 +90,8 @@ class TorPlugin implements DuplexPlugin, EventHandler {
|
||||
|
||||
TorPlugin(Executor ioExecutor, Context appContext,
|
||||
LocationUtils locationUtils, DuplexPluginCallback callback,
|
||||
int maxFrameLength, long maxLatency, long maxIdleTime,
|
||||
long pollingInterval) {
|
||||
int maxFrameLength, int maxLatency, int maxIdleTime,
|
||||
int pollingInterval) {
|
||||
this.ioExecutor = ioExecutor;
|
||||
this.appContext = appContext;
|
||||
this.locationUtils = locationUtils;
|
||||
@@ -100,9 +100,9 @@ class TorPlugin implements DuplexPlugin, EventHandler {
|
||||
this.maxLatency = maxLatency;
|
||||
this.maxIdleTime = maxIdleTime;
|
||||
this.pollingInterval = pollingInterval;
|
||||
if(2 * maxIdleTime > Integer.MAX_VALUE)
|
||||
if(maxIdleTime > Integer.MAX_VALUE / 2)
|
||||
socketTimeout = Integer.MAX_VALUE;
|
||||
else socketTimeout = (int) (2 * maxIdleTime);
|
||||
else socketTimeout = maxIdleTime * 2;
|
||||
torDirectory = appContext.getDir("tor", MODE_PRIVATE);
|
||||
torFile = new File(torDirectory, "tor");
|
||||
geoIpFile = new File(torDirectory, "geoip");
|
||||
@@ -121,11 +121,11 @@ class TorPlugin implements DuplexPlugin, EventHandler {
|
||||
return maxFrameLength;
|
||||
}
|
||||
|
||||
public long getMaxLatency() {
|
||||
public int getMaxLatency() {
|
||||
return maxLatency;
|
||||
}
|
||||
|
||||
public long getMaxIdleTime() {
|
||||
public int getMaxIdleTime() {
|
||||
return maxIdleTime;
|
||||
}
|
||||
|
||||
@@ -504,7 +504,7 @@ class TorPlugin implements DuplexPlugin, EventHandler {
|
||||
return true;
|
||||
}
|
||||
|
||||
public long getPollingInterval() {
|
||||
public int getPollingInterval() {
|
||||
return pollingInterval;
|
||||
}
|
||||
|
||||
|
||||
@@ -18,9 +18,9 @@ public class TorPluginFactory implements DuplexPluginFactory {
|
||||
Logger.getLogger(TorPluginFactory.class.getName());
|
||||
|
||||
private static final int MAX_FRAME_LENGTH = 1024;
|
||||
private static final long MAX_LATENCY = 60 * 1000; // 1 minute
|
||||
private static final long MAX_IDLE_TIME = 30 * 1000; // 30 seconds
|
||||
private static final long POLLING_INTERVAL = 3 * 60 * 1000; // 3 minutes
|
||||
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
|
||||
|
||||
private final Executor ioExecutor;
|
||||
private final Context appContext;
|
||||
|
||||
@@ -63,11 +63,11 @@ class TorTransportConnection implements DuplexTransportConnection {
|
||||
return plugin.getMaxFrameLength();
|
||||
}
|
||||
|
||||
public long getMaxLatency() {
|
||||
public int getMaxLatency() {
|
||||
return plugin.getMaxLatency();
|
||||
}
|
||||
|
||||
public long getMaxIdleTime() {
|
||||
public int getMaxIdleTime() {
|
||||
return plugin.getMaxIdleTime();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user