0
0
mirror of https://github.com/zeromq/libzmq.git synced 2024-12-27 15:41:05 +08:00

Problem: windows socket error number cleared before saved to saved_errno

Solution: call tune_socket only if connect was successful
This commit is contained in:
Simon Giesecke 2019-10-26 19:38:59 +02:00
parent 66d0f3511f
commit 302436515c

View File

@ -449,20 +449,23 @@ int zmq::make_fdpair (fd_t *r_, fd_t *w_)
}
// Listen for incoming connections.
if (rc != SOCKET_ERROR)
if (rc != SOCKET_ERROR) {
rc = listen (listener, 1);
}
// Connect writer to the listener.
if (rc != SOCKET_ERROR)
if (rc != SOCKET_ERROR) {
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)
if (rc != SOCKET_ERROR) {
// Set TCP_NODELAY on writer socket.
tune_socket (*w_);
*r_ = accept (listener, NULL, NULL);
}
// Send/receive large chunk to work around TCP slow start
// This code is a workaround for #1608