Retransmit messages based on maximum latency of transport.

This commit is contained in:
akwizgran
2013-02-06 15:11:55 +00:00
parent 5150737476
commit 9558bd88df
25 changed files with 134 additions and 76 deletions

View File

@@ -80,23 +80,25 @@ public interface DatabaseComponent {
/**
* Generates a batch of raw messages for the given contact, with a total
* length less than or equal to the given length. Returns null if
* there are no sendable messages that fit in the given length.
* length less than or equal to the given length, for transmission over a
* transport with the given maximum latency. Returns null if there are no
* sendable messages that fit in the given length.
*/
Collection<byte[]> generateBatch(ContactId c, int maxLength)
throws DbException;
Collection<byte[]> generateBatch(ContactId c, int maxLength,
long maxLatency) throws DbException;
/**
* Generates a batch of raw messages for the given contact from the given
* collection of requested messages, with a total length less than or equal
* to the given length. Any messages that were either added to the batch,
* or were considered but are no longer sendable to the contact, are
* removed from the collection of requested messages before returning.
* Returns null if there are no sendable messages that fit in the given
* length.
* to the given length, for transmission over a transport with the given
* maximum latency. Any messages that were either added to the batch, or
* were considered but are no longer sendable to the contact, are removed
* from the collection of requested messages before returning. Returns null
* if there are no sendable messages that fit in the given length.
*/
Collection<byte[]> generateBatch(ContactId c, int maxLength,
Collection<MessageId> requested) throws DbException;
long maxLatency, Collection<MessageId> requested)
throws DbException;
/**
* Generates an offer for the given contact. Returns null if there are no

View File

@@ -11,6 +11,9 @@ import java.io.OutputStream;
*/
public interface DuplexTransportConnection {
/** Returns the maximum latency of the transport in milliseconds. */
long getMaxLatency();
/** Returns an input stream for reading from the connection. */
InputStream getInputStream() throws IOException;

View File

@@ -12,6 +12,9 @@ public interface SimplexTransportWriter {
/** Returns the capacity of the transport in bytes. */
long getCapacity();
/** Returns the maximum latency of the transport in milliseconds. */
long getMaxLatency();
/** Returns an output stream for writing to the transport. */
OutputStream getOutputStream() throws IOException;