summaryrefslogtreecommitdiffstats
path: root/remote-processor
diff options
context:
space:
mode:
authorDavid Wagner <david.wagner@intel.com>2013-12-05 19:29:33 +0100
committerDavid Wagner <david.wagner@intel.com>2014-02-12 17:04:16 +0100
commit3e783c2172a05bf5557086301442e7b56aba78a2 (patch)
tree38c0ebd06a3139119d3e5a2831169b5604f66e3f /remote-processor
parentdf8bf839ca3b7ce9a0ac6f1b645f27bdbc8509e5 (diff)
downloadexternal_parameter-framework-3e783c2172a05bf5557086301442e7b56aba78a2.zip
external_parameter-framework-3e783c2172a05bf5557086301442e7b56aba78a2.tar.gz
external_parameter-framework-3e783c2172a05bf5557086301442e7b56aba78a2.tar.bz2
remote-processor: configure the socket with the TCP_NODELAY option
BZ: 154316 The "man 7 tcp" page speaks for itself: TCP_NODELAY If set, disable the Nagle algorithm. This means that segments are always sent as soon as possible, even if there is only a small amount of data. When not set, data is buffered until there is a sufficient amount to send out, thereby avoiding the frequent sending of small packets, which results in poor utilization of the network. The behaviour described above if this option is not set introduces a lot of overhead when several commands are sent with remote-processor because they are not sent in burst mode: instead, remote-processor wait for the answer to each command. See "man 7 tcp" for all the details. Change-Id: I6c8ede4428629a16e9a2927d73a2897873a57d37 Signed-off-by: David Wagner <david.wagner@intel.com>
Diffstat (limited to 'remote-processor')
-rw-r--r--remote-processor/Socket.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/remote-processor/Socket.cpp b/remote-processor/Socket.cpp
index 2ae8870..77582e2 100644
--- a/remote-processor/Socket.cpp
+++ b/remote-processor/Socket.cpp
@@ -31,11 +31,19 @@
#include <strings.h>
#include <fcntl.h>
#include <netinet/in.h>
+#include <netinet/tcp.h>
#include <sys/time.h>
CSocket::CSocket() : _iSockFd(socket(AF_INET, SOCK_STREAM, 0))
{
assert(_iSockFd != -1);
+
+ int iNoDelay = 1;
+ // (see man 7 tcp)
+ // Setting TCP_NODELAY allows us sending commands and responses as soon as
+ // they are ready to be sent, instead of waiting for more data on the
+ // socket.
+ setsockopt(_iSockFd, IPPROTO_TCP, TCP_NODELAY, (char *)&iNoDelay, sizeof(iNoDelay));
}
CSocket::CSocket(int iSockId) : _iSockFd(iSockId)