Moved connection window size to TransportConstants.

This commit is contained in:
akwizgran
2012-01-19 22:13:26 +00:00
parent aabb8fb5b3
commit 02c516492f
4 changed files with 7 additions and 7 deletions

View File

@@ -48,7 +48,4 @@ public interface ProtocolConstants {
/** The length of a message's random salt in bytes. */
static final int SALT_LENGTH = 8;
/** The size of the connection reordering window. */
static final int CONNECTION_WINDOW_SIZE = 32;
}

View File

@@ -23,4 +23,7 @@ public interface TransportConstants {
* plugins must support connections of at least this length.
*/
static final int MIN_CONNECTION_LENGTH = 1024 * 1024; // 2^20, 1 MiB
/** The size of the connection reordering window. */
static final int CONNECTION_WINDOW_SIZE = 32;
}

View File

@@ -1,6 +1,6 @@
package net.sf.briar.transport;
import static net.sf.briar.api.protocol.ProtocolConstants.CONNECTION_WINDOW_SIZE;
import static net.sf.briar.api.transport.TransportConstants.CONNECTION_WINDOW_SIZE;
import java.util.HashMap;
import java.util.Map;

View File

@@ -34,13 +34,13 @@ import net.sf.briar.api.protocol.GroupFactory;
import net.sf.briar.api.protocol.GroupId;
import net.sf.briar.api.protocol.Message;
import net.sf.briar.api.protocol.MessageId;
import net.sf.briar.api.protocol.ProtocolConstants;
import net.sf.briar.api.protocol.Transport;
import net.sf.briar.api.protocol.TransportId;
import net.sf.briar.api.protocol.TransportIndex;
import net.sf.briar.api.transport.ConnectionContextFactory;
import net.sf.briar.api.transport.ConnectionWindow;
import net.sf.briar.api.transport.ConnectionWindowFactory;
import net.sf.briar.api.transport.TransportConstants;
import net.sf.briar.crypto.CryptoModule;
import net.sf.briar.lifecycle.LifecycleModule;
import net.sf.briar.protocol.ProtocolModule;
@@ -1461,7 +1461,7 @@ public class H2DatabaseTest extends BriarTestCase {
remoteIndex);
// The connection window should exist and be in the initial state
assertNotNull(w);
long top = ProtocolConstants.CONNECTION_WINDOW_SIZE / 2 - 1;
long top = TransportConstants.CONNECTION_WINDOW_SIZE / 2 - 1;
for(long l = 0; l <= top; l++) assertFalse(w.isSeen(l));
db.commitTransaction(txn);
@@ -1481,7 +1481,7 @@ public class H2DatabaseTest extends BriarTestCase {
// The connection window should exist and be in the initial state
assertNotNull(w);
Map<Long, byte[]> unseen = w.getUnseen();
long top = ProtocolConstants.CONNECTION_WINDOW_SIZE / 2 - 1;
long top = TransportConstants.CONNECTION_WINDOW_SIZE / 2 - 1;
assertEquals(top + 1, unseen.size());
for(long l = 0; l <= top; l++) {
assertFalse(w.isSeen(l));