mirror of
https://github.com/zeromq/libzmq.git
synced 2025-10-26 18:42:43 +01:00
Set socket buffers before establishing TCP connection
The window scale option carried in SYN segment is computed from socket's receive buffer size. So we need to set this buffer size before calling connect or bind.
This commit is contained in:
@@ -83,25 +83,6 @@ zmq::stream_engine_t::stream_engine_t (fd_t fd_, const options_t &options_,
|
||||
|
||||
// Put the socket into non-blocking mode.
|
||||
unblock_socket (s);
|
||||
// Set the socket buffer limits for the underlying socket.
|
||||
if (options.sndbuf) {
|
||||
rc = setsockopt (s, SOL_SOCKET, SO_SNDBUF,
|
||||
(char*) &options.sndbuf, sizeof (int));
|
||||
#ifdef ZMQ_HAVE_WINDOWS
|
||||
wsa_assert (rc != SOCKET_ERROR);
|
||||
#else
|
||||
errno_assert (rc == 0);
|
||||
#endif
|
||||
}
|
||||
if (options.rcvbuf) {
|
||||
rc = setsockopt (s, SOL_SOCKET, SO_RCVBUF,
|
||||
(char*) &options.rcvbuf, sizeof (int));
|
||||
#ifdef ZMQ_HAVE_WINDOWS
|
||||
wsa_assert (rc != SOCKET_ERROR);
|
||||
#else
|
||||
errno_assert (rc == 0);
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef SO_NOSIGPIPE
|
||||
// Make sure that SIGPIPE signal is not generated when writing to a
|
||||
|
||||
Reference in New Issue
Block a user