Skip to content

Commit

Permalink
Set TCP_NODELAY
Browse files Browse the repository at this point in the history
Signed-off-by: falkTX <[email protected]>
  • Loading branch information
falkTX committed Sep 28, 2024
1 parent 8770226 commit fae0c49
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/socket.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
#else
#include <sys/socket.h>
#include <netinet/in.h>
#include <netinet/tcp.h>
#define closesocket close
#define INVALID_SOCKET -1
typedef int SOCKET;
Expand Down Expand Up @@ -160,7 +161,12 @@ int socket_start(int socket_port, int feedback_port, int buffer_size)
if (feedback_port != 0)
setsockopt(g_fbserverfd, SOL_SOCKET, SO_REUSEPORT, &value, sizeof(value));

/* increase socket size */
/* Set TCP_NODELAY */
setsockopt(g_serverfd, SOL_TCP, TCP_NODELAY, &value, sizeof(value));
if (feedback_port != 0)
setsockopt(g_fbserverfd, SOL_TCP, TCP_NODELAY, &value, sizeof(value));

/* Increase socket size */
value = 131071;
setsockopt(g_serverfd, SOL_SOCKET, SO_RCVBUF, &value, sizeof(value));
if (feedback_port != 0)
Expand Down

0 comments on commit fae0c49

Please sign in to comment.