Commit b824cb30b78b9a9d791b939b8fcb604927205ed5

Authored by Benjamin Renard
1 parent bcfd8089
Exists in master and in 1 other branch ubuntu

Activate TCP_NODELAY option to improve performance

Showing 1 changed file with 6 additions and 0 deletions   Show diff stats
src/DDClientLibCpp/DD_client.cc
@@ -25,6 +25,7 @@ @@ -25,6 +25,7 @@
25 #include <sys/socket.h> 25 #include <sys/socket.h>
26 #include <netinet/in.h> 26 #include <netinet/in.h>
27 #include <arpa/inet.h> 27 #include <arpa/inet.h>
  28 +#include <netinet/tcp.h>
28 29
29 #include "DD.hh" 30 #include "DD.hh"
30 31
@@ -223,6 +224,11 @@ int DD_Client::GetSocket() @@ -223,6 +224,11 @@ int DD_Client::GetSocket()
223 perror("Socket:"); return(-1); 224 perror("Socket:"); return(-1);
224 } 225 }
225 226
  227 + int flags = 1;
  228 + if (setsockopt(SocketID, SOL_TCP, TCP_NODELAY, (void *)&flags, sizeof(flags))) {
  229 + perror("ERROR: setsocketopt(), TCP_NODELAY"); return(-1);
  230 + }
  231 +
226 /* Filling full internet address for socket "name" 232 /* Filling full internet address for socket "name"
227 * this address will be used to get communication point */ 233 * this address will be used to get communication point */
228 234