Skip to content
Snippets Groups Projects
Commit 02c51649 authored by akwizgran's avatar akwizgran
Browse files

Moved connection window size to TransportConstants.

parent aabb8fb5
No related branches found
No related tags found
No related merge requests found
...@@ -48,7 +48,4 @@ public interface ProtocolConstants { ...@@ -48,7 +48,4 @@ public interface ProtocolConstants {
/** The length of a message's random salt in bytes. */ /** The length of a message's random salt in bytes. */
static final int SALT_LENGTH = 8; static final int SALT_LENGTH = 8;
/** The size of the connection reordering window. */
static final int CONNECTION_WINDOW_SIZE = 32;
} }
...@@ -23,4 +23,7 @@ public interface TransportConstants { ...@@ -23,4 +23,7 @@ public interface TransportConstants {
* plugins must support connections of at least this length. * plugins must support connections of at least this length.
*/ */
static final int MIN_CONNECTION_LENGTH = 1024 * 1024; // 2^20, 1 MiB 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;
} }
package net.sf.briar.transport; 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.HashMap;
import java.util.Map; import java.util.Map;
......
...@@ -34,13 +34,13 @@ import net.sf.briar.api.protocol.GroupFactory; ...@@ -34,13 +34,13 @@ import net.sf.briar.api.protocol.GroupFactory;
import net.sf.briar.api.protocol.GroupId; import net.sf.briar.api.protocol.GroupId;
import net.sf.briar.api.protocol.Message; import net.sf.briar.api.protocol.Message;
import net.sf.briar.api.protocol.MessageId; 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.Transport;
import net.sf.briar.api.protocol.TransportId; import net.sf.briar.api.protocol.TransportId;
import net.sf.briar.api.protocol.TransportIndex; import net.sf.briar.api.protocol.TransportIndex;
import net.sf.briar.api.transport.ConnectionContextFactory; import net.sf.briar.api.transport.ConnectionContextFactory;
import net.sf.briar.api.transport.ConnectionWindow; import net.sf.briar.api.transport.ConnectionWindow;
import net.sf.briar.api.transport.ConnectionWindowFactory; import net.sf.briar.api.transport.ConnectionWindowFactory;
import net.sf.briar.api.transport.TransportConstants;
import net.sf.briar.crypto.CryptoModule; import net.sf.briar.crypto.CryptoModule;
import net.sf.briar.lifecycle.LifecycleModule; import net.sf.briar.lifecycle.LifecycleModule;
import net.sf.briar.protocol.ProtocolModule; import net.sf.briar.protocol.ProtocolModule;
...@@ -1461,7 +1461,7 @@ public class H2DatabaseTest extends BriarTestCase { ...@@ -1461,7 +1461,7 @@ public class H2DatabaseTest extends BriarTestCase {
remoteIndex); remoteIndex);
// The connection window should exist and be in the initial state // The connection window should exist and be in the initial state
assertNotNull(w); 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)); for(long l = 0; l <= top; l++) assertFalse(w.isSeen(l));
db.commitTransaction(txn); db.commitTransaction(txn);
...@@ -1481,7 +1481,7 @@ public class H2DatabaseTest extends BriarTestCase { ...@@ -1481,7 +1481,7 @@ public class H2DatabaseTest extends BriarTestCase {
// The connection window should exist and be in the initial state // The connection window should exist and be in the initial state
assertNotNull(w); assertNotNull(w);
Map<Long, byte[]> unseen = w.getUnseen(); 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()); assertEquals(top + 1, unseen.size());
for(long l = 0; l <= top; l++) { for(long l = 0; l <= top; l++) {
assertFalse(w.isSeen(l)); assertFalse(w.isSeen(l));
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment