Use generic record reader/writer for sync.

This commit is contained in:
akwizgran
2018-04-19 13:11:48 +01:00
parent 4100daaa47
commit 215c62ed23
16 changed files with 203 additions and 243 deletions

View File

@@ -2,6 +2,8 @@ package org.briarproject.bramble.api.sync;
import org.briarproject.bramble.api.UniqueId;
import static org.briarproject.bramble.api.record.Record.MAX_RECORD_PAYLOAD_BYTES;
public interface SyncConstants {
/**
@@ -9,16 +11,6 @@ public interface SyncConstants {
*/
byte PROTOCOL_VERSION = 0;
/**
* The length of the record header in bytes.
*/
int RECORD_HEADER_LENGTH = 4;
/**
* The maximum length of the record payload in bytes.
*/
int MAX_RECORD_PAYLOAD_LENGTH = 48 * 1024; // 48 KiB
/**
* The maximum length of a group descriptor in bytes.
*/
@@ -42,5 +34,5 @@ public interface SyncConstants {
/**
* The maximum number of message IDs in an ack, offer or request record.
*/
int MAX_MESSAGE_IDS = MAX_RECORD_PAYLOAD_LENGTH / UniqueId.LENGTH;
int MAX_MESSAGE_IDS = MAX_RECORD_PAYLOAD_BYTES / UniqueId.LENGTH;
}