Check periodically for retransmittable packets. Bug #46.

This commit is contained in:
akwizgran
2014-12-14 20:26:41 +00:00
parent 29a6596ee3
commit 388b36b6be
51 changed files with 351 additions and 331 deletions

View File

@@ -20,5 +20,5 @@ public interface KeyManager extends Service {
* Called whenever an endpoint has been added. The initial secret is erased
* before returning.
*/
void endpointAdded(Endpoint ep, long maxLatency, byte[] initialSecret);
void endpointAdded(Endpoint ep, int maxLatency, byte[] initialSecret);
}

View File

@@ -73,7 +73,7 @@ public interface DatabaseComponent {
* Stores a transport and returns true if the transport was not previously
* in the database.
*/
boolean addTransport(TransportId t, long maxLatency) throws DbException;
boolean addTransport(TransportId t, int maxLatency) throws DbException;
/**
* Returns an acknowledgement for the given contact, or null if there are
@@ -88,14 +88,14 @@ public interface DatabaseComponent {
* sendable messages that fit in the given length.
*/
Collection<byte[]> generateBatch(ContactId c, int maxLength,
long maxLatency) throws DbException;
int maxLatency) throws DbException;
/**
* Returns an offer for the given contact for transmission over a
* transport with the given maximum latency, or null if there are no
* messages to offer.
*/
Offer generateOffer(ContactId c, int maxMessages, long maxLatency)
Offer generateOffer(ContactId c, int maxMessages, int maxLatency)
throws DbException;
/**
@@ -112,7 +112,7 @@ public interface DatabaseComponent {
* sendable messages that fit in the given length.
*/
Collection<byte[]> generateRequestedBatch(ContactId c, int maxLength,
long maxLatency) throws DbException;
int maxLatency) throws DbException;
/**
* Returns a retention ack for the given contact, or null if no retention
@@ -125,7 +125,7 @@ public interface DatabaseComponent {
* over a transport with the given latency. Returns null if no update is
* due.
*/
RetentionUpdate generateRetentionUpdate(ContactId c, long maxLatency)
RetentionUpdate generateRetentionUpdate(ContactId c, int maxLatency)
throws DbException;
/**
@@ -139,7 +139,7 @@ public interface DatabaseComponent {
* over a transport with the given latency. Returns null if no update is
* due.
*/
SubscriptionUpdate generateSubscriptionUpdate(ContactId c, long maxLatency)
SubscriptionUpdate generateSubscriptionUpdate(ContactId c, int maxLatency)
throws DbException;
/**
@@ -155,7 +155,7 @@ public interface DatabaseComponent {
* updates are due.
*/
Collection<TransportUpdate> generateTransportUpdates(ContactId c,
long maxLatency) throws DbException;
int maxLatency) throws DbException;
/**
* Returns the status of all groups to which the user subscribes or can
@@ -227,8 +227,8 @@ public interface DatabaseComponent {
/** Returns all contacts who subscribe to the given group. */
Collection<Contact> getSubscribers(GroupId g) throws DbException;
/** Returns the maximum latencies of all local transports. */
Map<TransportId, Long> getTransportLatencies() throws DbException;
/** Returns the maximum latencies of all supported transports. */
Map<TransportId, Integer> getTransportLatencies() throws DbException;
/** Returns the number of unread messages in each subscribed group. */
Map<GroupId, Integer> getUnreadMessageCounts() throws DbException;

View File

@@ -6,9 +6,9 @@ import org.briarproject.api.TransportId;
public class TransportAddedEvent extends Event {
private final TransportId transportId;
private final long maxLatency;
private final int maxLatency;
public TransportAddedEvent(TransportId transportId, long maxLatency) {
public TransportAddedEvent(TransportId transportId, int maxLatency) {
this.transportId = transportId;
this.maxLatency = maxLatency;
}
@@ -17,7 +17,7 @@ public class TransportAddedEvent extends Event {
return transportId;
}
public long getMaxLatency() {
public int getMaxLatency() {
return maxLatency;
}
}

View File

@@ -12,8 +12,8 @@ public interface MessagingSessionFactory {
InputStream in);
MessagingSession createSimplexOutgoingSession(ContactId c, TransportId t,
long maxLatency, OutputStream out);
int maxLatency, OutputStream out);
MessagingSession createDuplexOutgoingSession(ContactId c, TransportId t,
long maxLatency, long maxIdleTime, OutputStream out);
int maxLatency, int maxIdleTime, OutputStream out);
}

View File

@@ -29,4 +29,6 @@ public interface PacketWriter {
void writeTransportAck(TransportAck a) throws IOException;
void writeTransportUpdate(TransportUpdate u) throws IOException;
void flush() throws IOException;
}

View File

@@ -15,10 +15,10 @@ public interface Plugin {
int getMaxFrameLength();
/** Returns the transport's maximum latency in milliseconds. */
long getMaxLatency();
int getMaxLatency();
/** Returns the transport's maximum idle time in milliseconds. */
long getMaxIdleTime();
int getMaxIdleTime();
/** Starts the plugin and returns true if it started successfully. */
boolean start() throws IOException;
@@ -39,7 +39,7 @@ public interface Plugin {
* Returns the desired interval in milliseconds between calls to the
* plugin's {@link #poll(Collection)} method.
*/
long getPollingInterval();
int getPollingInterval();
/**
* Attempts to establish connections to contacts, passing any created

View File

@@ -13,10 +13,10 @@ public interface TransportConnectionWriter {
int getMaxFrameLength();
/** Returns the maximum latency of the transport in milliseconds. */
long getMaxLatency();
int getMaxLatency();
/** Returns the maximum idle time of the transport in milliseconds. */
long getMaxIdleTime();
int getMaxIdleTime();
/** Returns the capacity of the transport connection in bytes. */
long getCapacity();