Created
April 30, 2018 03:32
-
-
Save godmar/91934de8ffb5addb8e82b4a20c28d251 to your computer and use it in GitHub Desktop.
patch for socket.c that turns on TCP_NODELAY
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/src-solution/socket.c b/src-solution/socket.c | |
index 112e12b..6f0c402 100644 | |
--- a/src-solution/socket.c | |
+++ b/src-solution/socket.c | |
@@ -13,6 +13,7 @@ | |
#include <sys/sendfile.h> | |
#include <netdb.h> | |
#include <netinet/in.h> | |
+#include <netinet/tcp.h> | |
#include <errno.h> | |
#include <unistd.h> | |
#include <stdio.h> | |
@@ -145,6 +146,9 @@ socket_accept_client(int accepting_socket) | |
return -1; | |
} | |
+ int i = 1; | |
+ setsockopt(client, IPPROTO_TCP, TCP_NODELAY, (void *)&i, sizeof(i)); | |
+ | |
/* The following will help with debugging your server. | |
* Adjust and/or remove as you see fit. | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment