Centralize default stream input capacity with batch overhead
This commit is contained in:
1 parent
0e9478d033
commit
6a5bb84d71
2 files changed
+5
-1
No files matched your search
+1
-1
@@ -599,7 +599,7 @@ int stream_publish_open(struct UTUN_INSTANCE *inst, uint64_t group_id, const str
|
||||
int result = stream_open_check(inst, group_id, out);
|
||||
if (result != STREAM_OK) return result;
|
||||
struct stream_descriptor d = {.group_id = group_id, .source_node_id = inst->node_id,
|
||||
.n = parameters ? parameters->n : 8, .r = parameters ? parameters->r : 2,
|
||||
.n = parameters ? parameters->n : STREAM_DEFAULT_N, .r = parameters ? parameters->r : STREAM_DEFAULT_R,
|
||||
.block_size = parameters ? parameters->block_size : STREAM_RS_DEFAULT_SIZE};
|
||||
do {
|
||||
if (random_bytes((uint8_t *)&d.source_epoch, sizeof(d.source_epoch)) != 0) {
|
||||
|
||||
@@ -31,6 +31,10 @@
|
||||
#define STREAM_BATCH_OVERHEAD (STREAM_BATCH_HEADER + SC_SIGN_SIZE)
|
||||
#define STREAM_BLOCK_DEFAULT_SIZE 1300
|
||||
#define STREAM_RS_DEFAULT_SIZE (STREAM_BLOCK_DEFAULT_SIZE - STREAM_BLOCK_OVERHEAD)
|
||||
#define STREAM_DEFAULT_N 8
|
||||
#define STREAM_DEFAULT_R 2
|
||||
#define STREAM_DEFAULT_INPUT_CAPACITY \
|
||||
((STREAM_DEFAULT_N - STREAM_DEFAULT_R) * (STREAM_RS_DEFAULT_SIZE - RS_HEADER_SIZE) - STREAM_BATCH_OVERHEAD)
|
||||
#define STREAM_BLOCK_MAX_SIZE (RS_MAX_BLOCK_SIZE + STREAM_BLOCK_OVERHEAD)
|
||||
#define STREAM_BLOCK_TIME_RESET 0x01
|
||||
#define STREAM_BUFFER_BYTES (32u * 1024u * 1024u)
|
||||
|
||||
Reference in new issue
Block a user