]> git.ipfire.org Git - fireperf.git/commitdiff
Allocate send/receive buffers the same as socket buffers
authorMichael Tremer <michael.tremer@ipfire.org>
Mon, 1 Feb 2021 16:12:50 +0000 (16:12 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Mon, 1 Feb 2021 16:12:50 +0000 (16:12 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/client.c
src/main.h
src/server.c

index af39cd02b5af394ab369631fedefd249290fe9de..678502e391445e0060f50845dabced4b1f809d41 100644 (file)
@@ -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));
index 42959eb669ce6e46e4f3a8834398629654db91ae..50dd3ca5b7123d0004d6b5397ee64fec9bc5feb3 100644 (file)
@@ -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
index 21be19da5bcac3e0209f1d68f89d348f3a0b7656..d5bf2a9737f949fb5bb5b4237cfe767e9999c79c 100644 (file)
@@ -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