Problem: TCP_NODELAY is set prior to connecting, which is problematic on Windows

Solution: Set TCP_NODELAY after connect()

Reference: https://mail.openvswitch.org/pipermail/ovs-dev/2014-October/290251.html
This commit is contained in:
Jacques Germishuys 2018-12-14 11:45:07 +02:00
parent cfbbfb8ab8
commit a1ace32650

View File

@ -436,9 +436,6 @@ int zmq::make_fdpair (fd_t *r_, fd_t *w_)
*w_ = open_socket (AF_INET, SOCK_STREAM, 0);
wsa_assert (*w_ != INVALID_SOCKET);
// Set TCP_NODELAY on writer socket.
tune_socket (*w_);
if (sync != NULL) {
// Enter the critical section.
DWORD dwrc = WaitForSingleObject (sync, INFINITE);
@ -465,6 +462,9 @@ int zmq::make_fdpair (fd_t *r_, fd_t *w_)
rc = connect (*w_, reinterpret_cast<struct sockaddr *> (&addr),
sizeof addr);
// Set TCP_NODELAY on writer socket.
tune_socket (*w_);
// Accept connection from writer.
if (rc != SOCKET_ERROR)
*r_ = accept (listener, NULL, NULL);