mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-12 10:49:06 +01:00
Increase max latency of removable drive plugin to 28 days.
This commit is contained in:
@@ -87,7 +87,7 @@ class AndroidBluetoothPlugin extends
|
||||
Clock clock,
|
||||
Backoff backoff,
|
||||
PluginCallback callback,
|
||||
int maxLatency,
|
||||
long maxLatency,
|
||||
int maxIdleTime) {
|
||||
super(connectionLimiter, connectionFactory, ioExecutor,
|
||||
wakefulIoExecutor, secureRandom, backoff, callback,
|
||||
|
||||
@@ -75,7 +75,7 @@ public class AndroidBluetoothPluginFactory implements DuplexPluginFactory {
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxLatency() {
|
||||
public long getMaxLatency() {
|
||||
return MAX_LATENCY;
|
||||
}
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@ class AndroidRemovableDrivePlugin extends RemovableDrivePlugin {
|
||||
private final Application app;
|
||||
|
||||
AndroidRemovableDrivePlugin(Application app, PluginCallback callback,
|
||||
int maxLatency) {
|
||||
long maxLatency) {
|
||||
super(callback, maxLatency);
|
||||
this.app = app;
|
||||
}
|
||||
|
||||
@@ -35,7 +35,7 @@ public class AndroidRemovableDrivePluginFactory implements
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxLatency() {
|
||||
public long getMaxLatency() {
|
||||
return MAX_LATENCY;
|
||||
}
|
||||
|
||||
|
||||
@@ -67,7 +67,7 @@ class AndroidLanTcpPlugin extends LanTcpPlugin {
|
||||
Application app,
|
||||
Backoff backoff,
|
||||
PluginCallback callback,
|
||||
int maxLatency,
|
||||
long maxLatency,
|
||||
int maxIdleTime,
|
||||
int connectionTimeout) {
|
||||
super(ioExecutor, wakefulIoExecutor, backoff, callback, maxLatency,
|
||||
|
||||
@@ -55,7 +55,7 @@ public class AndroidLanTcpPluginFactory implements DuplexPluginFactory {
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxLatency() {
|
||||
public long getMaxLatency() {
|
||||
return MAX_LATENCY;
|
||||
}
|
||||
|
||||
|
||||
@@ -68,7 +68,7 @@ class AndroidTorPlugin extends TorPlugin {
|
||||
TorRendezvousCrypto torRendezvousCrypto,
|
||||
PluginCallback callback,
|
||||
String architecture,
|
||||
int maxLatency,
|
||||
long maxLatency,
|
||||
int maxIdleTime,
|
||||
File torDirectory) {
|
||||
super(ioExecutor, wakefulIoExecutor, networkManager, locationUtils,
|
||||
|
||||
@@ -94,7 +94,7 @@ public class AndroidTorPluginFactory implements DuplexPluginFactory {
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxLatency() {
|
||||
public long getMaxLatency() {
|
||||
return MAX_LATENCY;
|
||||
}
|
||||
|
||||
|
||||
@@ -101,7 +101,7 @@ public interface DatabaseComponent extends TransactionManager {
|
||||
/**
|
||||
* Stores a transport.
|
||||
*/
|
||||
void addTransport(Transaction txn, TransportId t, int maxLatency)
|
||||
void addTransport(Transaction txn, TransportId t, long maxLatency)
|
||||
throws DbException;
|
||||
|
||||
/**
|
||||
@@ -128,7 +128,7 @@ public interface DatabaseComponent extends TransactionManager {
|
||||
* should be included
|
||||
*/
|
||||
boolean containsAnythingToSend(Transaction txn, ContactId c,
|
||||
int maxLatency, boolean eager) throws DbException;
|
||||
long maxLatency, boolean eager) throws DbException;
|
||||
|
||||
/**
|
||||
* Returns true if the database contains the given contact for the given
|
||||
@@ -200,7 +200,7 @@ public interface DatabaseComponent extends TransactionManager {
|
||||
*/
|
||||
@Nullable
|
||||
Collection<Message> generateBatch(Transaction txn, ContactId c,
|
||||
int maxLength, int maxLatency) throws DbException;
|
||||
int maxLength, long maxLatency) throws DbException;
|
||||
|
||||
/**
|
||||
* Returns a batch of messages for the given contact containing the
|
||||
@@ -212,7 +212,7 @@ public interface DatabaseComponent extends TransactionManager {
|
||||
* exception.
|
||||
*/
|
||||
Collection<Message> generateBatch(Transaction txn, ContactId c,
|
||||
Collection<MessageId> ids, int maxLatency) throws DbException;
|
||||
Collection<MessageId> ids, long maxLatency) throws DbException;
|
||||
|
||||
/**
|
||||
* Returns an offer for the given contact for transmission over a
|
||||
@@ -221,7 +221,7 @@ public interface DatabaseComponent extends TransactionManager {
|
||||
*/
|
||||
@Nullable
|
||||
Offer generateOffer(Transaction txn, ContactId c, int maxMessages,
|
||||
int maxLatency) throws DbException;
|
||||
long maxLatency) throws DbException;
|
||||
|
||||
/**
|
||||
* Returns a request for the given contact, or null if there are no
|
||||
@@ -240,7 +240,7 @@ public interface DatabaseComponent extends TransactionManager {
|
||||
*/
|
||||
@Nullable
|
||||
Collection<Message> generateRequestedBatch(Transaction txn, ContactId c,
|
||||
int maxLength, int maxLatency) throws DbException;
|
||||
int maxLength, long maxLatency) throws DbException;
|
||||
|
||||
/**
|
||||
* Returns the contact with the given ID.
|
||||
|
||||
@@ -61,7 +61,7 @@ public interface Plugin {
|
||||
/**
|
||||
* Returns the transport's maximum latency in milliseconds.
|
||||
*/
|
||||
int getMaxLatency();
|
||||
long getMaxLatency();
|
||||
|
||||
/**
|
||||
* Returns the transport's maximum idle time in milliseconds.
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
package org.briarproject.bramble.api.plugin;
|
||||
|
||||
import org.briarproject.bramble.api.nullsafety.NotNullByDefault;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
@NotNullByDefault
|
||||
public interface PluginFactory<P extends Plugin> {
|
||||
|
||||
/**
|
||||
* Returns the plugin's transport identifier.
|
||||
*/
|
||||
TransportId getId();
|
||||
|
||||
/**
|
||||
* Returns the maximum latency of the transport in milliseconds.
|
||||
*/
|
||||
long getMaxLatency();
|
||||
|
||||
/**
|
||||
* Creates and returns a plugin, or null if no plugin can be created.
|
||||
*/
|
||||
@Nullable
|
||||
P createPlugin(PluginCallback callback);
|
||||
}
|
||||
@@ -15,7 +15,7 @@ public interface TransportConnectionWriter {
|
||||
/**
|
||||
* Returns the maximum latency of the transport in milliseconds.
|
||||
*/
|
||||
int getMaxLatency();
|
||||
long getMaxLatency();
|
||||
|
||||
/**
|
||||
* Returns the maximum idle time of the transport in milliseconds.
|
||||
|
||||
@@ -70,7 +70,7 @@ public abstract class AbstractDuplexTransportConnection
|
||||
private class Writer implements TransportConnectionWriter {
|
||||
|
||||
@Override
|
||||
public int getMaxLatency() {
|
||||
public long getMaxLatency() {
|
||||
return plugin.getMaxLatency();
|
||||
}
|
||||
|
||||
|
||||
@@ -1,30 +1,11 @@
|
||||
package org.briarproject.bramble.api.plugin.duplex;
|
||||
|
||||
import org.briarproject.bramble.api.nullsafety.NotNullByDefault;
|
||||
import org.briarproject.bramble.api.plugin.PluginCallback;
|
||||
import org.briarproject.bramble.api.plugin.TransportId;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import org.briarproject.bramble.api.plugin.PluginFactory;
|
||||
|
||||
/**
|
||||
* Factory for creating a plugin for a duplex transport.
|
||||
*/
|
||||
@NotNullByDefault
|
||||
public interface DuplexPluginFactory {
|
||||
|
||||
/**
|
||||
* Returns the plugin's transport identifier.
|
||||
*/
|
||||
TransportId getId();
|
||||
|
||||
/**
|
||||
* Returns the maximum latency of the transport in milliseconds.
|
||||
*/
|
||||
int getMaxLatency();
|
||||
|
||||
/**
|
||||
* Creates and returns a plugin, or null if no plugin can be created.
|
||||
*/
|
||||
@Nullable
|
||||
DuplexPlugin createPlugin(PluginCallback callback);
|
||||
public interface DuplexPluginFactory extends PluginFactory<DuplexPlugin> {
|
||||
}
|
||||
|
||||
@@ -1,30 +1,11 @@
|
||||
package org.briarproject.bramble.api.plugin.simplex;
|
||||
|
||||
import org.briarproject.bramble.api.nullsafety.NotNullByDefault;
|
||||
import org.briarproject.bramble.api.plugin.PluginCallback;
|
||||
import org.briarproject.bramble.api.plugin.TransportId;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import org.briarproject.bramble.api.plugin.PluginFactory;
|
||||
|
||||
/**
|
||||
* Factory for creating a plugin for a simplex transport.
|
||||
*/
|
||||
@NotNullByDefault
|
||||
public interface SimplexPluginFactory {
|
||||
|
||||
/**
|
||||
* Returns the plugin's transport identifier.
|
||||
*/
|
||||
TransportId getId();
|
||||
|
||||
/**
|
||||
* Returns the maximum latency of the transport in milliseconds.
|
||||
*/
|
||||
int getMaxLatency();
|
||||
|
||||
/**
|
||||
* Creates and returns a plugin, or null if no plugin can be created.
|
||||
*/
|
||||
@Nullable
|
||||
SimplexPlugin createPlugin(PluginCallback callback);
|
||||
public interface SimplexPluginFactory extends PluginFactory<SimplexPlugin> {
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@ import org.briarproject.bramble.api.UniqueId;
|
||||
import java.util.List;
|
||||
|
||||
import static java.util.Collections.singletonList;
|
||||
import static java.util.concurrent.TimeUnit.DAYS;
|
||||
import static org.briarproject.bramble.api.record.Record.MAX_RECORD_PAYLOAD_BYTES;
|
||||
|
||||
public interface SyncConstants {
|
||||
@@ -55,4 +56,9 @@ public interface SyncConstants {
|
||||
* connections.
|
||||
*/
|
||||
int PRIORITY_NONCE_BYTES = 16;
|
||||
|
||||
/**
|
||||
* The maximum allowed latency for any transport, in milliseconds.
|
||||
*/
|
||||
long MAX_TRANSPORT_LATENCY = DAYS.toMillis(365);
|
||||
}
|
||||
|
||||
@@ -16,9 +16,9 @@ public interface SyncSessionFactory {
|
||||
PriorityHandler handler);
|
||||
|
||||
SyncSession createSimplexOutgoingSession(ContactId c, TransportId t,
|
||||
int maxLatency, boolean eager, StreamWriter streamWriter);
|
||||
long maxLatency, boolean eager, StreamWriter streamWriter);
|
||||
|
||||
SyncSession createDuplexOutgoingSession(ContactId c, TransportId t,
|
||||
int maxLatency, int maxIdleTime, StreamWriter streamWriter,
|
||||
long maxLatency, int maxIdleTime, StreamWriter streamWriter,
|
||||
@Nullable Priority priority);
|
||||
}
|
||||
|
||||
@@ -145,7 +145,7 @@ interface Database<T> {
|
||||
/**
|
||||
* Stores a transport.
|
||||
*/
|
||||
void addTransport(T txn, TransportId t, int maxLatency)
|
||||
void addTransport(T txn, TransportId t, long maxLatency)
|
||||
throws DbException;
|
||||
|
||||
/**
|
||||
@@ -171,7 +171,7 @@ interface Database<T> {
|
||||
* @param eager True if messages that are not yet due for retransmission
|
||||
* should be included
|
||||
*/
|
||||
boolean containsAnythingToSend(T txn, ContactId c, int maxLatency,
|
||||
boolean containsAnythingToSend(T txn, ContactId c, long maxLatency,
|
||||
boolean eager) throws DbException;
|
||||
|
||||
/**
|
||||
@@ -483,7 +483,7 @@ interface Database<T> {
|
||||
* Read-only.
|
||||
*/
|
||||
Collection<MessageId> getMessagesToOffer(T txn, ContactId c,
|
||||
int maxMessages, int maxLatency) throws DbException;
|
||||
int maxMessages, long maxLatency) throws DbException;
|
||||
|
||||
/**
|
||||
* Returns the IDs of some messages that are eligible to be requested from
|
||||
@@ -505,13 +505,13 @@ interface Database<T> {
|
||||
* Read-only.
|
||||
*/
|
||||
Collection<MessageId> getMessagesToSend(T txn, ContactId c, int maxLength,
|
||||
int maxLatency) throws DbException;
|
||||
long maxLatency) throws DbException;
|
||||
|
||||
/**
|
||||
* Returns the IDs of all messages that are eligible to be sent to the
|
||||
* given contact, together with their raw lengths.
|
||||
* <p/>
|
||||
* Unlike {@link #getMessagesToSend(Object, ContactId, int, int)} this
|
||||
* Unlike {@link #getMessagesToSend(Object, ContactId, int, long)} this
|
||||
* method may return messages that have already been sent and are not yet
|
||||
* due for retransmission.
|
||||
* <p/>
|
||||
@@ -604,7 +604,7 @@ interface Database<T> {
|
||||
* Read-only.
|
||||
*/
|
||||
Collection<MessageId> getRequestedMessagesToSend(T txn, ContactId c,
|
||||
int maxLength, int maxLatency) throws DbException;
|
||||
int maxLength, long maxLatency) throws DbException;
|
||||
|
||||
/**
|
||||
* Returns all settings in the given namespace.
|
||||
@@ -845,7 +845,7 @@ interface Database<T> {
|
||||
* of the given message with respect to the given contact, using the latency
|
||||
* of the transport over which it was sent.
|
||||
*/
|
||||
void updateExpiryTimeAndEta(T txn, ContactId c, MessageId m, int maxLatency)
|
||||
void updateExpiryTimeAndEta(T txn, ContactId c, MessageId m, long maxLatency)
|
||||
throws DbException;
|
||||
|
||||
/**
|
||||
|
||||
@@ -310,7 +310,7 @@ class DatabaseComponentImpl<T> implements DatabaseComponent {
|
||||
|
||||
@Override
|
||||
public void addTransport(Transaction transaction, TransportId t,
|
||||
int maxLatency) throws DbException {
|
||||
long maxLatency) throws DbException {
|
||||
if (transaction.isReadOnly()) throw new IllegalArgumentException();
|
||||
T txn = unbox(transaction);
|
||||
if (!db.containsTransport(txn, t))
|
||||
@@ -343,7 +343,7 @@ class DatabaseComponentImpl<T> implements DatabaseComponent {
|
||||
|
||||
@Override
|
||||
public boolean containsAnythingToSend(Transaction transaction, ContactId c,
|
||||
int maxLatency, boolean eager) throws DbException {
|
||||
long maxLatency, boolean eager) throws DbException {
|
||||
T txn = unbox(transaction);
|
||||
if (!db.containsContact(txn, c))
|
||||
throw new NoSuchContactException();
|
||||
@@ -424,7 +424,7 @@ class DatabaseComponentImpl<T> implements DatabaseComponent {
|
||||
@Nullable
|
||||
@Override
|
||||
public Collection<Message> generateBatch(Transaction transaction,
|
||||
ContactId c, int maxLength, int maxLatency) throws DbException {
|
||||
ContactId c, int maxLength, long maxLatency) throws DbException {
|
||||
if (transaction.isReadOnly()) throw new IllegalArgumentException();
|
||||
T txn = unbox(transaction);
|
||||
if (!db.containsContact(txn, c))
|
||||
@@ -447,7 +447,7 @@ class DatabaseComponentImpl<T> implements DatabaseComponent {
|
||||
|
||||
@Override
|
||||
public Collection<Message> generateBatch(Transaction transaction,
|
||||
ContactId c, Collection<MessageId> ids, int maxLatency)
|
||||
ContactId c, Collection<MessageId> ids, long maxLatency)
|
||||
throws DbException {
|
||||
if (transaction.isReadOnly()) throw new IllegalArgumentException();
|
||||
T txn = unbox(transaction);
|
||||
@@ -474,7 +474,7 @@ class DatabaseComponentImpl<T> implements DatabaseComponent {
|
||||
@Nullable
|
||||
@Override
|
||||
public Offer generateOffer(Transaction transaction, ContactId c,
|
||||
int maxMessages, int maxLatency) throws DbException {
|
||||
int maxMessages, long maxLatency) throws DbException {
|
||||
if (transaction.isReadOnly()) throw new IllegalArgumentException();
|
||||
T txn = unbox(transaction);
|
||||
if (!db.containsContact(txn, c))
|
||||
@@ -505,7 +505,7 @@ class DatabaseComponentImpl<T> implements DatabaseComponent {
|
||||
@Nullable
|
||||
@Override
|
||||
public Collection<Message> generateRequestedBatch(Transaction transaction,
|
||||
ContactId c, int maxLength, int maxLatency) throws DbException {
|
||||
ContactId c, int maxLength, long maxLatency) throws DbException {
|
||||
if (transaction.isReadOnly()) throw new IllegalArgumentException();
|
||||
T txn = unbox(transaction);
|
||||
if (!db.containsContact(txn, c))
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package org.briarproject.bramble.db;
|
||||
|
||||
import static org.briarproject.bramble.api.sync.SyncConstants.MAX_TRANSPORT_LATENCY;
|
||||
|
||||
class ExponentialBackoff {
|
||||
|
||||
/**
|
||||
@@ -11,9 +13,11 @@ class ExponentialBackoff {
|
||||
* transmissions increases exponentially. If the expiry time would
|
||||
* be greater than Long.MAX_VALUE, Long.MAX_VALUE is returned.
|
||||
*/
|
||||
static long calculateExpiry(long now, int maxLatency, int txCount) {
|
||||
static long calculateExpiry(long now, long maxLatency, int txCount) {
|
||||
if (now < 0) throw new IllegalArgumentException();
|
||||
if (maxLatency <= 0) throw new IllegalArgumentException();
|
||||
if (maxLatency <= 0 || maxLatency > MAX_TRANSPORT_LATENCY) {
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
if (txCount < 0) throw new IllegalArgumentException();
|
||||
// The maximum round-trip time is twice the maximum latency
|
||||
long roundTrip = maxLatency * 2L;
|
||||
|
||||
@@ -102,7 +102,7 @@ import static org.briarproject.bramble.util.LogUtils.now;
|
||||
abstract class JdbcDatabase implements Database<Connection> {
|
||||
|
||||
// Package access for testing
|
||||
static final int CODE_SCHEMA_VERSION = 48;
|
||||
static final int CODE_SCHEMA_VERSION = 49;
|
||||
|
||||
// Time period offsets for incoming transport keys
|
||||
private static final int OFFSET_PREV = -1;
|
||||
@@ -267,7 +267,7 @@ abstract class JdbcDatabase implements Database<Connection> {
|
||||
private static final String CREATE_TRANSPORTS =
|
||||
"CREATE TABLE transports"
|
||||
+ " (transportId _STRING NOT NULL,"
|
||||
+ " maxLatency INT NOT NULL,"
|
||||
+ " maxLatency BIGINT NOT NULL,"
|
||||
+ " PRIMARY KEY (transportId))";
|
||||
|
||||
private static final String CREATE_PENDING_CONTACTS =
|
||||
@@ -498,7 +498,8 @@ abstract class JdbcDatabase implements Database<Connection> {
|
||||
new Migration44_45(),
|
||||
new Migration45_46(),
|
||||
new Migration46_47(dbTypes),
|
||||
new Migration47_48()
|
||||
new Migration47_48(),
|
||||
new Migration48_49()
|
||||
);
|
||||
}
|
||||
|
||||
@@ -1006,7 +1007,7 @@ abstract class JdbcDatabase implements Database<Connection> {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addTransport(Connection txn, TransportId t, int maxLatency)
|
||||
public void addTransport(Connection txn, TransportId t, long maxLatency)
|
||||
throws DbException {
|
||||
PreparedStatement ps = null;
|
||||
try {
|
||||
@@ -1129,7 +1130,7 @@ abstract class JdbcDatabase implements Database<Connection> {
|
||||
|
||||
@Override
|
||||
public boolean containsAnythingToSend(Connection txn, ContactId c,
|
||||
int maxLatency, boolean eager) throws DbException {
|
||||
long maxLatency, boolean eager) throws DbException {
|
||||
PreparedStatement ps = null;
|
||||
ResultSet rs = null;
|
||||
try {
|
||||
@@ -2188,7 +2189,7 @@ abstract class JdbcDatabase implements Database<Connection> {
|
||||
|
||||
@Override
|
||||
public Collection<MessageId> getMessagesToOffer(Connection txn,
|
||||
ContactId c, int maxMessages, int maxLatency) throws DbException {
|
||||
ContactId c, int maxMessages, long maxLatency) throws DbException {
|
||||
long now = clock.currentTimeMillis();
|
||||
long eta = now + maxLatency;
|
||||
PreparedStatement ps = null;
|
||||
@@ -2247,7 +2248,7 @@ abstract class JdbcDatabase implements Database<Connection> {
|
||||
|
||||
@Override
|
||||
public Collection<MessageId> getMessagesToSend(Connection txn, ContactId c,
|
||||
int maxLength, int maxLatency) throws DbException {
|
||||
int maxLength, long maxLatency) throws DbException {
|
||||
long now = clock.currentTimeMillis();
|
||||
long eta = now + maxLatency;
|
||||
PreparedStatement ps = null;
|
||||
@@ -2546,7 +2547,7 @@ abstract class JdbcDatabase implements Database<Connection> {
|
||||
|
||||
@Override
|
||||
public Collection<MessageId> getRequestedMessagesToSend(Connection txn,
|
||||
ContactId c, int maxLength, int maxLatency) throws DbException {
|
||||
ContactId c, int maxLength, long maxLatency) throws DbException {
|
||||
long now = clock.currentTimeMillis();
|
||||
long eta = now + maxLatency;
|
||||
PreparedStatement ps = null;
|
||||
@@ -3617,7 +3618,7 @@ abstract class JdbcDatabase implements Database<Connection> {
|
||||
|
||||
@Override
|
||||
public void updateExpiryTimeAndEta(Connection txn, ContactId c, MessageId m,
|
||||
int maxLatency) throws DbException {
|
||||
long maxLatency) throws DbException {
|
||||
PreparedStatement ps = null;
|
||||
ResultSet rs = null;
|
||||
try {
|
||||
|
||||
@@ -0,0 +1,41 @@
|
||||
package org.briarproject.bramble.db;
|
||||
|
||||
import org.briarproject.bramble.api.db.DbException;
|
||||
|
||||
import java.sql.Connection;
|
||||
import java.sql.SQLException;
|
||||
import java.sql.Statement;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import static java.util.logging.Level.WARNING;
|
||||
import static java.util.logging.Logger.getLogger;
|
||||
import static org.briarproject.bramble.db.JdbcUtils.tryToClose;
|
||||
|
||||
class Migration48_49 implements Migration<Connection> {
|
||||
|
||||
private static final Logger LOG = getLogger(Migration48_49.class.getName());
|
||||
|
||||
@Override
|
||||
public int getStartVersion() {
|
||||
return 48;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getEndVersion() {
|
||||
return 49;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void migrate(Connection txn) throws DbException {
|
||||
Statement s = null;
|
||||
try {
|
||||
s = txn.createStatement();
|
||||
s.execute("ALTER TABLE transports"
|
||||
+ " ALTER COLUMN maxLatency"
|
||||
+ " SET DATA TYPE BIGINT");
|
||||
} catch (SQLException e) {
|
||||
tryToClose(s, LOG, WARNING);
|
||||
throw new DbException(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -79,7 +79,8 @@ abstract class AbstractBluetoothPlugin<S, SS> implements BluetoothPlugin,
|
||||
private final SecureRandom secureRandom;
|
||||
private final Backoff backoff;
|
||||
private final PluginCallback callback;
|
||||
private final int maxLatency, maxIdleTime;
|
||||
private final long maxLatency;
|
||||
private final int maxIdleTime;
|
||||
private final AtomicBoolean used = new AtomicBoolean(false);
|
||||
private final AtomicBoolean everConnected = new AtomicBoolean(false);
|
||||
|
||||
@@ -121,7 +122,7 @@ abstract class AbstractBluetoothPlugin<S, SS> implements BluetoothPlugin,
|
||||
SecureRandom secureRandom,
|
||||
Backoff backoff,
|
||||
PluginCallback callback,
|
||||
int maxLatency,
|
||||
long maxLatency,
|
||||
int maxIdleTime) {
|
||||
this.connectionLimiter = connectionLimiter;
|
||||
this.connectionFactory = connectionFactory;
|
||||
@@ -158,7 +159,7 @@ abstract class AbstractBluetoothPlugin<S, SS> implements BluetoothPlugin,
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxLatency() {
|
||||
public long getMaxLatency() {
|
||||
return maxLatency;
|
||||
}
|
||||
|
||||
|
||||
@@ -33,7 +33,7 @@ abstract class AbstractRemovableDrivePlugin implements SimplexPlugin {
|
||||
private static final Logger LOG =
|
||||
getLogger(AbstractRemovableDrivePlugin.class.getName());
|
||||
|
||||
private final int maxLatency;
|
||||
private final long maxLatency;
|
||||
private final PluginCallback callback;
|
||||
|
||||
abstract InputStream openInputStream(TransportProperties p)
|
||||
@@ -42,7 +42,7 @@ abstract class AbstractRemovableDrivePlugin implements SimplexPlugin {
|
||||
abstract OutputStream openOutputStream(TransportProperties p)
|
||||
throws IOException;
|
||||
|
||||
AbstractRemovableDrivePlugin(PluginCallback callback, int maxLatency) {
|
||||
AbstractRemovableDrivePlugin(PluginCallback callback, long maxLatency) {
|
||||
this.callback = callback;
|
||||
this.maxLatency = maxLatency;
|
||||
}
|
||||
@@ -53,7 +53,7 @@ abstract class AbstractRemovableDrivePlugin implements SimplexPlugin {
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxLatency() {
|
||||
public long getMaxLatency() {
|
||||
return maxLatency;
|
||||
}
|
||||
|
||||
|
||||
@@ -27,20 +27,20 @@ abstract class FilePlugin implements SimplexPlugin {
|
||||
getLogger(FilePlugin.class.getName());
|
||||
|
||||
protected final PluginCallback callback;
|
||||
protected final int maxLatency;
|
||||
protected final long maxLatency;
|
||||
|
||||
protected abstract void writerFinished(File f, boolean exception);
|
||||
|
||||
protected abstract void readerFinished(File f, boolean exception,
|
||||
boolean recognised);
|
||||
|
||||
FilePlugin(PluginCallback callback, int maxLatency) {
|
||||
FilePlugin(PluginCallback callback, long maxLatency) {
|
||||
this.callback = callback;
|
||||
this.maxLatency = maxLatency;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxLatency() {
|
||||
public long getMaxLatency() {
|
||||
return maxLatency;
|
||||
}
|
||||
|
||||
|
||||
@@ -27,7 +27,7 @@ class FileTransportWriter implements TransportConnectionWriter {
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxLatency() {
|
||||
public long getMaxLatency() {
|
||||
return plugin.getMaxLatency();
|
||||
}
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@ import static org.briarproject.bramble.util.StringUtils.isNullOrEmpty;
|
||||
@NotNullByDefault
|
||||
class RemovableDrivePlugin extends AbstractRemovableDrivePlugin {
|
||||
|
||||
RemovableDrivePlugin(PluginCallback callback, int maxLatency) {
|
||||
RemovableDrivePlugin(PluginCallback callback, long maxLatency) {
|
||||
super(callback, maxLatency);
|
||||
}
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@ import static org.briarproject.bramble.api.plugin.file.RemovableDriveConstants.I
|
||||
@NotNullByDefault
|
||||
public class RemovableDrivePluginFactory implements SimplexPluginFactory {
|
||||
|
||||
static final int MAX_LATENCY = (int) DAYS.toMillis(14);
|
||||
static final long MAX_LATENCY = DAYS.toMillis(28);
|
||||
|
||||
@Inject
|
||||
RemovableDrivePluginFactory() {
|
||||
@@ -29,7 +29,7 @@ public class RemovableDrivePluginFactory implements SimplexPluginFactory {
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxLatency() {
|
||||
public long getMaxLatency() {
|
||||
return MAX_LATENCY;
|
||||
}
|
||||
|
||||
|
||||
@@ -96,7 +96,7 @@ class RemovableDriveWriterTask extends RemovableDriveTaskImpl
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxLatency() {
|
||||
public long getMaxLatency() {
|
||||
return delegate.getMaxLatency();
|
||||
}
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@ class TransportOutputStreamWriter implements TransportConnectionWriter {
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxLatency() {
|
||||
public long getMaxLatency() {
|
||||
return plugin.getMaxLatency();
|
||||
}
|
||||
|
||||
|
||||
@@ -92,7 +92,7 @@ class LanTcpPlugin extends TcpPlugin {
|
||||
Executor wakefulIoExecutor,
|
||||
Backoff backoff,
|
||||
PluginCallback callback,
|
||||
int maxLatency,
|
||||
long maxLatency,
|
||||
int maxIdleTime,
|
||||
int connectionTimeout) {
|
||||
super(ioExecutor, wakefulIoExecutor, backoff, callback, maxLatency,
|
||||
|
||||
@@ -50,7 +50,7 @@ public class LanTcpPluginFactory implements DuplexPluginFactory {
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxLatency() {
|
||||
public long getMaxLatency() {
|
||||
return MAX_LATENCY;
|
||||
}
|
||||
|
||||
|
||||
@@ -69,8 +69,8 @@ abstract class TcpPlugin implements DuplexPlugin, EventListener {
|
||||
protected final Executor ioExecutor, wakefulIoExecutor, bindExecutor;
|
||||
protected final Backoff backoff;
|
||||
protected final PluginCallback callback;
|
||||
protected final int maxLatency, maxIdleTime;
|
||||
protected final int connectionTimeout, socketTimeout;
|
||||
protected final long maxLatency;
|
||||
protected final int maxIdleTime, connectionTimeout, socketTimeout;
|
||||
protected final AtomicBoolean used = new AtomicBoolean(false);
|
||||
protected final PluginState state = new PluginState();
|
||||
|
||||
@@ -111,7 +111,7 @@ abstract class TcpPlugin implements DuplexPlugin, EventListener {
|
||||
Executor wakefulIoExecutor,
|
||||
Backoff backoff,
|
||||
PluginCallback callback,
|
||||
int maxLatency,
|
||||
long maxLatency,
|
||||
int maxIdleTime,
|
||||
int connectionTimeout) {
|
||||
this.ioExecutor = ioExecutor;
|
||||
@@ -129,7 +129,7 @@ abstract class TcpPlugin implements DuplexPlugin, EventListener {
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxLatency() {
|
||||
public long getMaxLatency() {
|
||||
return maxLatency;
|
||||
}
|
||||
|
||||
|
||||
@@ -35,7 +35,7 @@ class WanTcpPlugin extends TcpPlugin {
|
||||
Backoff backoff,
|
||||
PortMapper portMapper,
|
||||
PluginCallback callback,
|
||||
int maxLatency,
|
||||
long maxLatency,
|
||||
int maxIdleTime,
|
||||
int connectionTimeout) {
|
||||
super(ioExecutor, wakefulIoExecutor, backoff, callback, maxLatency,
|
||||
|
||||
@@ -54,7 +54,7 @@ public class WanTcpPluginFactory implements DuplexPluginFactory {
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxLatency() {
|
||||
public long getMaxLatency() {
|
||||
return MAX_LATENCY;
|
||||
}
|
||||
|
||||
|
||||
@@ -131,7 +131,8 @@ abstract class TorPlugin implements DuplexPlugin, EventHandler, EventListener {
|
||||
private final String architecture;
|
||||
private final CircumventionProvider circumventionProvider;
|
||||
private final ResourceProvider resourceProvider;
|
||||
private final int maxLatency, maxIdleTime, socketTimeout;
|
||||
private final long maxLatency;
|
||||
private final int maxIdleTime, socketTimeout;
|
||||
private final File torDirectory, geoIpFile, configFile;
|
||||
private final File doneFile, cookieFile;
|
||||
private final AtomicBoolean used = new AtomicBoolean(false);
|
||||
@@ -159,7 +160,7 @@ abstract class TorPlugin implements DuplexPlugin, EventHandler, EventListener {
|
||||
TorRendezvousCrypto torRendezvousCrypto,
|
||||
PluginCallback callback,
|
||||
String architecture,
|
||||
int maxLatency,
|
||||
long maxLatency,
|
||||
int maxIdleTime,
|
||||
File torDirectory) {
|
||||
this.ioExecutor = ioExecutor;
|
||||
@@ -204,7 +205,7 @@ abstract class TorPlugin implements DuplexPlugin, EventHandler, EventListener {
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxLatency() {
|
||||
public long getMaxLatency() {
|
||||
return maxLatency;
|
||||
}
|
||||
|
||||
|
||||
@@ -77,7 +77,7 @@ class DuplexOutgoingSession implements SyncSession, EventListener {
|
||||
private final Clock clock;
|
||||
private final ContactId contactId;
|
||||
private final TransportId transportId;
|
||||
private final int maxLatency, maxIdleTime;
|
||||
private final long maxLatency, maxIdleTime;
|
||||
private final StreamWriter streamWriter;
|
||||
private final SyncRecordWriter recordWriter;
|
||||
@Nullable
|
||||
@@ -95,7 +95,7 @@ class DuplexOutgoingSession implements SyncSession, EventListener {
|
||||
|
||||
DuplexOutgoingSession(DatabaseComponent db, Executor dbExecutor,
|
||||
EventBus eventBus, Clock clock, ContactId contactId,
|
||||
TransportId transportId, int maxLatency, int maxIdleTime,
|
||||
TransportId transportId, long maxLatency, int maxIdleTime,
|
||||
StreamWriter streamWriter, SyncRecordWriter recordWriter,
|
||||
@Nullable Priority priority) {
|
||||
this.db = db;
|
||||
|
||||
@@ -65,7 +65,7 @@ class SimplexOutgoingSession implements SyncSession, EventListener {
|
||||
private final EventBus eventBus;
|
||||
private final ContactId contactId;
|
||||
private final TransportId transportId;
|
||||
private final int maxLatency;
|
||||
private final long maxLatency;
|
||||
private final boolean eager;
|
||||
private final StreamWriter streamWriter;
|
||||
private final SyncRecordWriter recordWriter;
|
||||
@@ -76,7 +76,7 @@ class SimplexOutgoingSession implements SyncSession, EventListener {
|
||||
|
||||
SimplexOutgoingSession(DatabaseComponent db, Executor dbExecutor,
|
||||
EventBus eventBus, ContactId contactId, TransportId transportId,
|
||||
int maxLatency, boolean eager, StreamWriter streamWriter,
|
||||
long maxLatency, boolean eager, StreamWriter streamWriter,
|
||||
SyncRecordWriter recordWriter) {
|
||||
this.db = db;
|
||||
this.dbExecutor = dbExecutor;
|
||||
|
||||
@@ -60,7 +60,7 @@ class SyncSessionFactoryImpl implements SyncSessionFactory {
|
||||
|
||||
@Override
|
||||
public SyncSession createSimplexOutgoingSession(ContactId c, TransportId t,
|
||||
int maxLatency, boolean eager, StreamWriter streamWriter) {
|
||||
long maxLatency, boolean eager, StreamWriter streamWriter) {
|
||||
OutputStream out = streamWriter.getOutputStream();
|
||||
SyncRecordWriter recordWriter =
|
||||
recordWriterFactory.createRecordWriter(out);
|
||||
@@ -70,7 +70,7 @@ class SyncSessionFactoryImpl implements SyncSessionFactory {
|
||||
|
||||
@Override
|
||||
public SyncSession createDuplexOutgoingSession(ContactId c, TransportId t,
|
||||
int maxLatency, int maxIdleTime, StreamWriter streamWriter,
|
||||
long maxLatency, int maxIdleTime, StreamWriter streamWriter,
|
||||
@Nullable Priority priority) {
|
||||
OutputStream out = streamWriter.getOutputStream();
|
||||
SyncRecordWriter recordWriter =
|
||||
|
||||
@@ -19,9 +19,8 @@ import org.briarproject.bramble.api.lifecycle.Service;
|
||||
import org.briarproject.bramble.api.lifecycle.ServiceException;
|
||||
import org.briarproject.bramble.api.nullsafety.NotNullByDefault;
|
||||
import org.briarproject.bramble.api.plugin.PluginConfig;
|
||||
import org.briarproject.bramble.api.plugin.PluginFactory;
|
||||
import org.briarproject.bramble.api.plugin.TransportId;
|
||||
import org.briarproject.bramble.api.plugin.duplex.DuplexPluginFactory;
|
||||
import org.briarproject.bramble.api.plugin.simplex.SimplexPluginFactory;
|
||||
import org.briarproject.bramble.api.transport.KeyManager;
|
||||
import org.briarproject.bramble.api.transport.KeySetId;
|
||||
import org.briarproject.bramble.api.transport.StreamContext;
|
||||
@@ -40,6 +39,7 @@ import javax.annotation.concurrent.ThreadSafe;
|
||||
import javax.inject.Inject;
|
||||
|
||||
import static java.util.logging.Level.INFO;
|
||||
import static org.briarproject.bramble.api.sync.SyncConstants.MAX_TRANSPORT_LATENCY;
|
||||
|
||||
@ThreadSafe
|
||||
@NotNullByDefault
|
||||
@@ -67,12 +67,12 @@ class KeyManagerImpl implements KeyManager, Service, EventListener {
|
||||
this.pluginConfig = pluginConfig;
|
||||
this.transportCrypto = transportCrypto;
|
||||
managers = new ConcurrentHashMap<>();
|
||||
for (SimplexPluginFactory f : pluginConfig.getSimplexFactories()) {
|
||||
for (PluginFactory<?> f : pluginConfig.getSimplexFactories()) {
|
||||
TransportKeyManager m = transportKeyManagerFactory.
|
||||
createTransportKeyManager(f.getId(), f.getMaxLatency());
|
||||
managers.put(f.getId(), m);
|
||||
}
|
||||
for (DuplexPluginFactory f : pluginConfig.getDuplexFactories()) {
|
||||
for (PluginFactory<?> f : pluginConfig.getDuplexFactories()) {
|
||||
TransportKeyManager m = transportKeyManagerFactory.
|
||||
createTransportKeyManager(f.getId(), f.getMaxLatency());
|
||||
managers.put(f.getId(), m);
|
||||
@@ -84,15 +84,11 @@ class KeyManagerImpl implements KeyManager, Service, EventListener {
|
||||
if (used.getAndSet(true)) throw new IllegalStateException();
|
||||
try {
|
||||
db.transaction(false, txn -> {
|
||||
for (SimplexPluginFactory f :
|
||||
pluginConfig.getSimplexFactories()) {
|
||||
db.addTransport(txn, f.getId(), f.getMaxLatency());
|
||||
managers.get(f.getId()).start(txn);
|
||||
for (PluginFactory<?> f : pluginConfig.getSimplexFactories()) {
|
||||
addTransport(txn, f);
|
||||
}
|
||||
for (DuplexPluginFactory f :
|
||||
pluginConfig.getDuplexFactories()) {
|
||||
db.addTransport(txn, f.getId(), f.getMaxLatency());
|
||||
managers.get(f.getId()).start(txn);
|
||||
for (PluginFactory<?> f : pluginConfig.getDuplexFactories()) {
|
||||
addTransport(txn, f);
|
||||
}
|
||||
});
|
||||
} catch (DbException e) {
|
||||
@@ -100,6 +96,16 @@ class KeyManagerImpl implements KeyManager, Service, EventListener {
|
||||
}
|
||||
}
|
||||
|
||||
private void addTransport(Transaction txn, PluginFactory<?> f)
|
||||
throws DbException {
|
||||
long maxLatency = f.getMaxLatency();
|
||||
if (maxLatency > MAX_TRANSPORT_LATENCY) {
|
||||
throw new IllegalStateException();
|
||||
}
|
||||
db.addTransport(txn, f.getId(), maxLatency);
|
||||
managers.get(f.getId()).start(txn);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void stopService() {
|
||||
}
|
||||
|
||||
@@ -22,9 +22,8 @@ import org.briarproject.bramble.api.identity.IdentityManager;
|
||||
import org.briarproject.bramble.api.lifecycle.LifecycleManager.OpenDatabaseHook;
|
||||
import org.briarproject.bramble.api.nullsafety.NotNullByDefault;
|
||||
import org.briarproject.bramble.api.plugin.PluginConfig;
|
||||
import org.briarproject.bramble.api.plugin.PluginFactory;
|
||||
import org.briarproject.bramble.api.plugin.TransportId;
|
||||
import org.briarproject.bramble.api.plugin.duplex.DuplexPluginFactory;
|
||||
import org.briarproject.bramble.api.plugin.simplex.SimplexPluginFactory;
|
||||
import org.briarproject.bramble.api.sync.Group;
|
||||
import org.briarproject.bramble.api.sync.Group.Visibility;
|
||||
import org.briarproject.bramble.api.sync.GroupId;
|
||||
@@ -110,11 +109,11 @@ class TransportKeyAgreementManagerImpl extends BdfIncomingMessageHook
|
||||
this.sessionParser = sessionParser;
|
||||
this.crypto = crypto;
|
||||
transports = new ArrayList<>();
|
||||
for (DuplexPluginFactory duplex : config.getDuplexFactories()) {
|
||||
transports.add(duplex.getId());
|
||||
for (PluginFactory<?> f : config.getDuplexFactories()) {
|
||||
transports.add(f.getId());
|
||||
}
|
||||
for (SimplexPluginFactory simplex : config.getSimplexFactories()) {
|
||||
transports.add(simplex.getId());
|
||||
for (PluginFactory<?> f : config.getSimplexFactories()) {
|
||||
transports.add(f.getId());
|
||||
}
|
||||
localGroup = contactGroupFactory.createLocalGroup(CLIENT_ID,
|
||||
MAJOR_VERSION);
|
||||
|
||||
@@ -120,7 +120,7 @@ public class DatabaseComponentImplTest extends BrambleMockTestCase {
|
||||
private final MessageId messageId, messageId1;
|
||||
private final Metadata metadata;
|
||||
private final TransportId transportId;
|
||||
private final int maxLatency;
|
||||
private final long maxLatency;
|
||||
private final ContactId contactId;
|
||||
private final Contact contact;
|
||||
private final KeySetId keySetId;
|
||||
|
||||
@@ -3,6 +3,7 @@ package org.briarproject.bramble.db;
|
||||
import org.briarproject.bramble.test.BrambleTestCase;
|
||||
import org.junit.Test;
|
||||
|
||||
import static org.briarproject.bramble.api.sync.SyncConstants.MAX_TRANSPORT_LATENCY;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
public class ExponentialBackoffTest extends BrambleTestCase {
|
||||
@@ -36,28 +37,28 @@ public class ExponentialBackoffTest extends BrambleTestCase {
|
||||
|
||||
@Test
|
||||
public void testTransmissionCountOverflow() {
|
||||
int maxLatency = Integer.MAX_VALUE; // RTT will not overflow
|
||||
long maxLatency = MAX_TRANSPORT_LATENCY; // RTT will not overflow
|
||||
long expiry = ExponentialBackoff.calculateExpiry(0, maxLatency, 0);
|
||||
assertEquals(Integer.MAX_VALUE * 2L, expiry); // No overflow
|
||||
expiry = ExponentialBackoff.calculateExpiry(0, maxLatency, 31);
|
||||
assertEquals(Integer.MAX_VALUE * (2L << 31), expiry); // No overflow
|
||||
expiry = ExponentialBackoff.calculateExpiry(0, maxLatency, 32);
|
||||
assertEquals(MAX_TRANSPORT_LATENCY * 2L, expiry); // No overflow
|
||||
expiry = ExponentialBackoff.calculateExpiry(0, maxLatency, 27);
|
||||
assertEquals(MAX_TRANSPORT_LATENCY * (2L << 27), expiry); // No overflow
|
||||
expiry = ExponentialBackoff.calculateExpiry(0, maxLatency, 28);
|
||||
assertEquals(Long.MAX_VALUE, expiry); // Overflow caught
|
||||
expiry = ExponentialBackoff.calculateExpiry(0, maxLatency, 33);
|
||||
expiry = ExponentialBackoff.calculateExpiry(0, maxLatency, 29);
|
||||
assertEquals(Long.MAX_VALUE, expiry); // Overflow caught
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testCurrentTimeOverflow() {
|
||||
int maxLatency = Integer.MAX_VALUE; // RTT will not overflow
|
||||
long now = Long.MAX_VALUE - (Integer.MAX_VALUE * (2L << 31));
|
||||
long maxLatency = MAX_TRANSPORT_LATENCY; // RTT will not overflow
|
||||
long now = Long.MAX_VALUE - (MAX_TRANSPORT_LATENCY * (2L << 27));
|
||||
long expiry = ExponentialBackoff.calculateExpiry(now, maxLatency, 0);
|
||||
assertEquals(now + Integer.MAX_VALUE * 2L, expiry); // No overflow
|
||||
expiry = ExponentialBackoff.calculateExpiry(now - 1, maxLatency, 31);
|
||||
assertEquals(now + MAX_TRANSPORT_LATENCY * 2L, expiry); // No overflow
|
||||
expiry = ExponentialBackoff.calculateExpiry(now - 1, maxLatency, 27);
|
||||
assertEquals(Long.MAX_VALUE - 1, expiry); // No overflow
|
||||
expiry = ExponentialBackoff.calculateExpiry(now, maxLatency, 31);
|
||||
expiry = ExponentialBackoff.calculateExpiry(now, maxLatency, 27);
|
||||
assertEquals(Long.MAX_VALUE, expiry); // No overflow
|
||||
expiry = ExponentialBackoff.calculateExpiry(now + 1, maxLatency, 32);
|
||||
expiry = ExponentialBackoff.calculateExpiry(now + 1, maxLatency, 27);
|
||||
assertEquals(Long.MAX_VALUE, expiry); // Overflow caught
|
||||
}
|
||||
}
|
||||
|
||||
@@ -50,7 +50,7 @@ public class TestPluginConfigModule {
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxLatency() {
|
||||
public long getMaxLatency() {
|
||||
return MAX_LATENCY;
|
||||
}
|
||||
|
||||
@@ -70,7 +70,7 @@ public class TestPluginConfigModule {
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxLatency() {
|
||||
public long getMaxLatency() {
|
||||
return MAX_LATENCY;
|
||||
}
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@ public class TestTransportConnectionWriter
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxLatency() {
|
||||
public long getMaxLatency() {
|
||||
return 30_000;
|
||||
}
|
||||
|
||||
|
||||
@@ -81,7 +81,7 @@ public class KeyManagerImplTest extends BrambleMockTestCase {
|
||||
context.mock(SimplexPluginFactory.class);
|
||||
Collection<SimplexPluginFactory> factories =
|
||||
singletonList(pluginFactory);
|
||||
int maxLatency = 1337;
|
||||
long maxLatency = 1337;
|
||||
|
||||
context.checking(new Expectations() {{
|
||||
allowing(pluginConfig).getSimplexFactories();
|
||||
|
||||
@@ -41,7 +41,7 @@ class JavaBluetoothPlugin extends
|
||||
SecureRandom secureRandom,
|
||||
Backoff backoff,
|
||||
PluginCallback callback,
|
||||
int maxLatency,
|
||||
long maxLatency,
|
||||
int maxIdleTime) {
|
||||
super(connectionManager, connectionFactory, ioExecutor,
|
||||
wakefulIoExecutor, secureRandom, backoff, callback,
|
||||
|
||||
@@ -58,7 +58,7 @@ public class JavaBluetoothPluginFactory implements DuplexPluginFactory {
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxLatency() {
|
||||
public long getMaxLatency() {
|
||||
return MAX_LATENCY;
|
||||
}
|
||||
|
||||
|
||||
@@ -50,14 +50,14 @@ class ModemPlugin implements DuplexPlugin, Modem.Callback {
|
||||
private final ModemFactory modemFactory;
|
||||
private final SerialPortList serialPortList;
|
||||
private final PluginCallback callback;
|
||||
private final int maxLatency;
|
||||
private final long maxLatency;
|
||||
private final AtomicBoolean used = new AtomicBoolean(false);
|
||||
private final PluginState state = new PluginState();
|
||||
|
||||
private volatile Modem modem = null;
|
||||
|
||||
ModemPlugin(ModemFactory modemFactory, SerialPortList serialPortList,
|
||||
PluginCallback callback, int maxLatency) {
|
||||
PluginCallback callback, long maxLatency) {
|
||||
this.modemFactory = modemFactory;
|
||||
this.serialPortList = serialPortList;
|
||||
this.callback = callback;
|
||||
@@ -70,7 +70,7 @@ class ModemPlugin implements DuplexPlugin, Modem.Callback {
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxLatency() {
|
||||
public long getMaxLatency() {
|
||||
return maxLatency;
|
||||
}
|
||||
|
||||
|
||||
@@ -36,7 +36,7 @@ public class ModemPluginFactory implements DuplexPluginFactory {
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxLatency() {
|
||||
public long getMaxLatency() {
|
||||
return MAX_LATENCY;
|
||||
}
|
||||
|
||||
|
||||
@@ -33,7 +33,7 @@ abstract class JavaTorPlugin extends TorPlugin {
|
||||
TorRendezvousCrypto torRendezvousCrypto,
|
||||
PluginCallback callback,
|
||||
String architecture,
|
||||
int maxLatency,
|
||||
long maxLatency,
|
||||
int maxIdleTime,
|
||||
File torDirectory) {
|
||||
super(ioExecutor, wakefulIoExecutor, networkManager, locationUtils,
|
||||
|
||||
@@ -33,7 +33,7 @@ class UnixTorPlugin extends JavaTorPlugin {
|
||||
TorRendezvousCrypto torRendezvousCrypto,
|
||||
PluginCallback callback,
|
||||
String architecture,
|
||||
int maxLatency,
|
||||
long maxLatency,
|
||||
int maxIdleTime,
|
||||
File torDirectory) {
|
||||
super(ioExecutor, wakefulIoExecutor, networkManager, locationUtils,
|
||||
|
||||
@@ -87,7 +87,7 @@ public class UnixTorPluginFactory implements DuplexPluginFactory {
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxLatency() {
|
||||
public long getMaxLatency() {
|
||||
return MAX_LATENCY;
|
||||
}
|
||||
|
||||
|
||||
@@ -702,13 +702,13 @@
|
||||
<string name="removable_drive_receive_intro">Tap the button below to choose the file that your contact sent you.\n\nIf the file is on a removable drive, insert the drive now.</string>
|
||||
<string name="removable_drive_receive_button">Choose file for import</string>
|
||||
<string name="removable_drive_success_send_title">Export successful</string>
|
||||
<string name="removable_drive_success_send_text">Data exported successfully. You now have 14 days to transport the file to your contact.\n\nIf the file is on a removable drive, use the notification in the status bar to eject the drive before unplugging it.</string>
|
||||
<string name="removable_drive_success_send_text">Data exported successfully. You now have 28 days to transport the file to your contact.\n\nIf the file is on a removable drive, use the notification in the status bar to eject the drive before unplugging it.</string>
|
||||
<string name="removable_drive_success_receive_title">Import successful</string>
|
||||
<string name="removable_drive_success_receive_text">All encrypted messages contained in this file have been received.</string>
|
||||
<string name="removable_drive_error_send_title">Error exporting data</string>
|
||||
<string name="removable_drive_error_send_text">There was an error writing data to the file.\n\nIf you are using a removable drive, ensure that it is properly inserted and try again.\n\nIf the error persists, please send feedback to let the Briar team know about the issue.</string>
|
||||
<string name="removable_drive_error_receive_title">Error importing data</string>
|
||||
<string name="removable_drive_error_receive_text">The selected file did not contain anything that Briar could recognize.\n\nPlease check that you chose the right file.\n\nIf your contact created the file more than 14 days ago, Briar will not be able to recognize it.</string>
|
||||
<string name="removable_drive_error_receive_text">The selected file did not contain anything that Briar could recognize.\n\nPlease check that you chose the right file.\n\nIf your contact created the file more than 28 days ago, Briar will not be able to recognize it.</string>
|
||||
|
||||
|
||||
<!-- Screenshots -->
|
||||
|
||||
Reference in New Issue
Block a user