mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-12 10:49:06 +01:00
New polling logic for Bluetooth. #251
The polling interval increases exponentially each time polling is unsuccessful, up to a maximum of 60 minutes. The interval is reset to 2 minutes whenever a connection is made and whenever Bluetooth is re-enabled.
This commit is contained in:
22
briar-api/src/org/briarproject/api/plugins/Backoff.java
Normal file
22
briar-api/src/org/briarproject/api/plugins/Backoff.java
Normal file
@@ -0,0 +1,22 @@
|
||||
package org.briarproject.api.plugins;
|
||||
|
||||
/**
|
||||
* Calculates polling intervals for transport plugins that use backoff.
|
||||
*/
|
||||
public interface Backoff {
|
||||
|
||||
/**
|
||||
* Returns the current polling interval.
|
||||
*/
|
||||
int getPollingInterval();
|
||||
|
||||
/**
|
||||
* Increments the backoff counter.
|
||||
*/
|
||||
void increment();
|
||||
|
||||
/**
|
||||
* Resets the backoff counter.
|
||||
*/
|
||||
void reset();
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
package org.briarproject.api.plugins;
|
||||
|
||||
public interface BackoffFactory {
|
||||
|
||||
Backoff createBackoff(int minInterval, int maxInterval,
|
||||
double base);
|
||||
}
|
||||
Reference in New Issue
Block a user