mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-12 18:59:06 +01:00
Use keepalives to detect dead connections.
This commit is contained in:
@@ -35,9 +35,10 @@ class JavaBluetoothPlugin extends BluetoothPlugin<StreamConnectionNotifier> {
|
||||
|
||||
JavaBluetoothPlugin(BluetoothConnectionLimiter connectionManager,
|
||||
Executor ioExecutor, SecureRandom secureRandom,
|
||||
Backoff backoff, PluginCallback callback, int maxLatency) {
|
||||
Backoff backoff, PluginCallback callback, int maxLatency,
|
||||
int maxIdleTime) {
|
||||
super(connectionManager, ioExecutor, secureRandom, backoff, callback,
|
||||
maxLatency);
|
||||
maxLatency, maxIdleTime);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -21,6 +21,7 @@ import static org.briarproject.bramble.api.plugin.BluetoothConstants.ID;
|
||||
public class JavaBluetoothPluginFactory implements DuplexPluginFactory {
|
||||
|
||||
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 MIN_POLLING_INTERVAL = 60 * 1000; // 1 minute
|
||||
private static final int MAX_POLLING_INTERVAL = 10 * 60 * 1000; // 10 mins
|
||||
private static final double BACKOFF_BASE = 1.2;
|
||||
@@ -56,7 +57,8 @@ public class JavaBluetoothPluginFactory implements DuplexPluginFactory {
|
||||
Backoff backoff = backoffFactory.createBackoff(MIN_POLLING_INTERVAL,
|
||||
MAX_POLLING_INTERVAL, BACKOFF_BASE);
|
||||
JavaBluetoothPlugin plugin = new JavaBluetoothPlugin(connectionLimiter,
|
||||
ioExecutor, secureRandom, backoff, callback, MAX_LATENCY);
|
||||
ioExecutor, secureRandom, backoff, callback, MAX_LATENCY,
|
||||
MAX_IDLE_TIME);
|
||||
eventBus.addListener(plugin);
|
||||
return plugin;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user