Commit 3c1a161ea8c5385d085d255b73903ca700122d55

Authored by Benjamin Renard
1 parent 711afcff
Exists in master and in 2 other branches WIP, ubuntu

Activate TCP_NODELAY option to improve performance

Showing 1 changed file with 6 additions and 0 deletions   Show diff stats
src/SERVER/DD_Server.c
@@ -31,6 +31,7 @@ @@ -31,6 +31,7 @@
31 #include <unistd.h> 31 #include <unistd.h>
32 #include "DD.h" 32 #include "DD.h"
33 #include "DD_comm.h" 33 #include "DD_comm.h"
  34 +#include <netinet/tcp.h>
34 35
35 /*-------------- Global definitions ------------------------*/ 36 /*-------------- Global definitions ------------------------*/
36 extern int errno; 37 extern int errno;
@@ -67,6 +68,7 @@ int SetListener() @@ -67,6 +68,7 @@ int SetListener()
67 68
68 int cc,i,j; 69 int cc,i,j;
69 int arg = 0; 70 int arg = 0;
  71 + int flags = 1;
70 72
71 /* 73 /*
72 *---------- Getting socket and its address --------------------- 74 *---------- Getting socket and its address ---------------------
@@ -111,6 +113,10 @@ int SetListener() @@ -111,6 +113,10 @@ int SetListener()
111 { 113 {
112 perror("Socket:"); return(-1); 114 perror("Socket:"); return(-1);
113 } 115 }
  116 +
  117 + if (setsockopt(SocketID, SOL_TCP, TCP_NODELAY, (void *)&flags, sizeof(flags))) {
  118 + perror("setsocketopt(), TCP_NODELAY"); return(-1);
  119 + }
114 /* 120 /*
115 * Filling full internet address for socket "name" 121 * Filling full internet address for socket "name"
116 * this address will be used to bind point 122 * this address will be used to bind point