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:
akwizgran
2016-02-12 15:40:01 +00:00
parent a774b3419a
commit c081c08ff5
16 changed files with 216 additions and 133 deletions

View 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();
}

View File

@@ -0,0 +1,7 @@
package org.briarproject.api.plugins;
public interface BackoffFactory {
Backoff createBackoff(int minInterval, int maxInterval,
double base);
}