New retransmission mechanism, which does away with the need for bundle IDs and should cope better with high bandwidth-delay product links.

This commit is contained in:
akwizgran
2011-07-14 09:39:15 +01:00
parent d889a08cf4
commit a121dcdda8
17 changed files with 206 additions and 299 deletions

View File

@@ -1,26 +0,0 @@
package net.sf.briar.api.protocol;
import java.util.Arrays;
/**
* Type-safe wrapper for a byte array that uniquely identifies a bundle of
* acknowledgements, subscriptions, and batches of messages.
*/
public class BundleId extends UniqueId {
public static final BundleId NONE = new BundleId(new byte[] {
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
});
public BundleId(byte[] id) {
super(id);
}
@Override
public boolean equals(Object o) {
if(o instanceof BundleId)
return Arrays.equals(id, ((BundleId) o).id);
return false;
}
}

View File

@@ -13,8 +13,8 @@ public interface BundleWriter {
/** Returns the bundle's remaining capacity in bytes. */
long getRemainingCapacity() throws IOException;
/** Adds a header to the bundle and returns its identifier. */
BundleId addHeader(Iterable<BatchId> acks, Iterable<GroupId> subs,
/** Adds a header to the bundle. */
void addHeader(Iterable<BatchId> acks, Iterable<GroupId> subs,
Map<String, String> transports) throws IOException,
GeneralSecurityException;

View File

@@ -8,9 +8,6 @@ public interface Header {
static final int MAX_SIZE = 1024 * 1024;
// FIXME: Remove BundleId when refactoring is complete
BundleId getId();
/** Returns the acknowledgements contained in the header. */
Set<BatchId> getAcks();