Commit 3b8254da authored by Pieter Hintjens's avatar Pieter Hintjens

Merge pull request #900 from pijyoi/master

fix: win32 tcp_keepalive gets set even when option is -1
parents 1879b8ba 9d3d9d63
...@@ -95,6 +95,7 @@ void zmq::tune_tcp_keepalives (fd_t s_, int keepalive_, int keepalive_cnt_, int ...@@ -95,6 +95,7 @@ void zmq::tune_tcp_keepalives (fd_t s_, int keepalive_, int keepalive_cnt_, int
// Tuning TCP keep-alives if platform allows it // Tuning TCP keep-alives if platform allows it
// All values = -1 means skip and leave it for OS // All values = -1 means skip and leave it for OS
#ifdef ZMQ_HAVE_WINDOWS #ifdef ZMQ_HAVE_WINDOWS
if (keepalive_ != -1) {
tcp_keepalive keepalive_opts; tcp_keepalive keepalive_opts;
keepalive_opts.onoff = keepalive_; keepalive_opts.onoff = keepalive_;
keepalive_opts.keepalivetime = keepalive_idle_ != -1 ? keepalive_idle_ * 1000 : 7200000; keepalive_opts.keepalivetime = keepalive_idle_ != -1 ? keepalive_idle_ * 1000 : 7200000;
...@@ -102,6 +103,7 @@ void zmq::tune_tcp_keepalives (fd_t s_, int keepalive_, int keepalive_cnt_, int ...@@ -102,6 +103,7 @@ void zmq::tune_tcp_keepalives (fd_t s_, int keepalive_, int keepalive_cnt_, int
DWORD num_bytes_returned; DWORD num_bytes_returned;
int rc = WSAIoctl(s_, SIO_KEEPALIVE_VALS, &keepalive_opts, sizeof(keepalive_opts), NULL, 0, &num_bytes_returned, NULL, NULL); int rc = WSAIoctl(s_, SIO_KEEPALIVE_VALS, &keepalive_opts, sizeof(keepalive_opts), NULL, 0, &num_bytes_returned, NULL, NULL);
wsa_assert (rc != SOCKET_ERROR); wsa_assert (rc != SOCKET_ERROR);
}
#else #else
#ifdef ZMQ_HAVE_SO_KEEPALIVE #ifdef ZMQ_HAVE_SO_KEEPALIVE
if (keepalive_ != -1) { if (keepalive_ != -1) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment