summaryrefslogtreecommitdiff
path: root/src/tcp_connecter.cpp
diff options
context:
space:
mode:
authorMartin Sustrik <sustrik@250bpm.com>2011-07-28 15:13:04 +0200
committerMartin Sustrik <sustrik@250bpm.com>2011-07-28 15:13:04 +0200
commitb45fec337aff8e04bebaf6e898a499f05ee6b0d6 (patch)
treec0e86a97203c533e9808a5c81ace8e1ee4717bf1 /src/tcp_connecter.cpp
parent46b053b8d67ba4826302d53268edccf919e6d785 (diff)
Tuning of TCP sockets is done at a single place
Instead of being spread throughout the codebase, the tuning is done in tune_tcp_socket() function. Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
Diffstat (limited to 'src/tcp_connecter.cpp')
-rw-r--r--src/tcp_connecter.cpp22
1 files changed, 2 insertions, 20 deletions
diff --git a/src/tcp_connecter.cpp b/src/tcp_connecter.cpp
index 76ec0bc..27e56a1 100644
--- a/src/tcp_connecter.cpp
+++ b/src/tcp_connecter.cpp
@@ -26,8 +26,8 @@
#include "io_thread.hpp"
#include "platform.hpp"
#include "random.hpp"
-#include "ip.hpp"
#include "err.hpp"
+#include "ip.hpp"
#if defined ZMQ_HAVE_WINDOWS
#include "windows.hpp"
@@ -106,25 +106,7 @@ void zmq::tcp_connecter_t::out_event ()
return;
}
- // Disable Nagle's algorithm. We are doing data batching on 0MQ level,
- // so using Nagle wouldn't improve throughput in anyway, but it would
- // hurt latency.
- int nodelay = 1;
- int rc = setsockopt (fd, IPPROTO_TCP, TCP_NODELAY, (char*) &nodelay,
- sizeof (int));
-#ifdef ZMQ_HAVE_WINDOWS
- wsa_assert (rc != SOCKET_ERROR);
-#else
- errno_assert (rc == 0);
-#endif
-
-#ifdef ZMQ_HAVE_OPENVMS
- // Disable delayed acknowledgements as they hurt latency is serious manner.
- int nodelack = 1;
- rc = setsockopt (fd, IPPROTO_TCP, TCP_NODELACK, (char*) &nodelack,
- sizeof (int));
- errno_assert (rc != SOCKET_ERROR);
-#endif
+ tune_tcp_socket (fd);
// Create the engine object for this connection.
tcp_engine_t *engine = new (std::nothrow) tcp_engine_t (fd, options);