From: Michael Tremer Date: Mon, 1 Feb 2021 16:12:50 +0000 (+0000) Subject: Allocate send/receive buffers the same as socket buffers X-Git-Tag: 0.1.0~28 X-Git-Url: http://git.ipfire.org/gitweb/gitweb.cgi?a=commitdiff_plain;h=4e3f83a432052a422bf309a8eac0145d34069ab0;p=fireperf.git Allocate send/receive buffers the same as socket buffers Signed-off-by: Michael Tremer --- diff --git a/src/client.c b/src/client.c index af39cd0..678502e 100644 --- a/src/client.c +++ b/src/client.c @@ -136,7 +136,7 @@ static int randomize_buffer(char* buffer, size_t s) { } static int send_data_to_server(struct fireperf_config* conf, int fd) { - char buffer[BUFFER_SIZE] = { 0 }; + char buffer[SOCKET_SEND_BUFFER_SIZE] = { 0 }; ssize_t bytes_sent; DEBUG(conf, "Sending %zu bytes of data to server\n", sizeof(buffer)); diff --git a/src/main.h b/src/main.h index 42959eb..50dd3ca 100644 --- a/src/main.h +++ b/src/main.h @@ -32,9 +32,6 @@ #define MAX_PARALLEL (1 << 20) -// Set the size of the read/write buffer to 1 MiB -#define BUFFER_SIZE 1048576 - // Socket buffer configuration #define SOCKET_BUFFER_SIZE (64 * 1024) #define SOCKET_RECV_BUFFER_SIZE SOCKET_BUFFER_SIZE diff --git a/src/server.c b/src/server.c index 21be19d..d5bf2a9 100644 --- a/src/server.c +++ b/src/server.c @@ -237,7 +237,7 @@ static int accept_connection(struct fireperf_config* conf, int sockfd) { static int handle_io_on_connection(struct fireperf_config* conf, struct fireperf_server_stats* stats, int fd) { - char buffer[BUFFER_SIZE]; + char buffer[SOCKET_RECV_BUFFER_SIZE]; ssize_t bytes_read; // Try reading into buffer