From dc5c9fd10aa6ba4d1e5581cc1d5d2f0414b6efcd Mon Sep 17 00:00:00 2001 From: Raymaekers Luca Date: Sat, 26 Oct 2024 16:26:34 +0200 Subject: Use dynamic limits for buffers Use arenas where possible to have growable buffers - Use of bufArena in server and client for receiving&sending messages - Use of inputArena in client Also organized code --- common.h | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'common.h') diff --git a/common.h b/common.h index 60d8984..700d741 100644 --- a/common.h +++ b/common.h @@ -13,12 +13,11 @@ #define TIMESTAMP_LEN 9 // port to listen on #define PORT 9983 -// buffer size for holding data received from recv() -// TODO: choose a good size -#define STREAM_BUF 1024 -// max data received in one recv() call on serverfd -// TODO: choose a good size -#define STREAM_LIMIT 1024 +// How much bytes can be sent at once over the stream +// This is also Intial size for buffer used to send and receive data, +// "initial" because the buffer is tied to an arena and can grow. +// Note: must be greater than sizeof(Message) - sizeof(Message.text) +#define STREAM_LIMIT 64 typedef uint8_t u8; typedef uint16_t u16; -- cgit v1.2.3