diff options
author | mruddy <6440430+mruddy@users.noreply.github.com> | 2018-11-08 06:38:21 -0500 |
---|---|---|
committer | mruddy <6440430+mruddy@users.noreply.github.com> | 2018-11-15 08:16:25 -0500 |
commit | c276df775914e4e42993c76e172ef159e3b830d4 (patch) | |
tree | 8bba4fee9755974b946a1d95aac811aa1c8b61e0 /src | |
parent | e74649e95122c9c61aadf607461cf701c3953f88 (diff) |
zmq: enable tcp keepalive
Diffstat (limited to 'src')
-rw-r--r-- | src/zmq/zmqpublishnotifier.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/zmq/zmqpublishnotifier.cpp b/src/zmq/zmqpublishnotifier.cpp index 15d4ac1b89..e2177efe56 100644 --- a/src/zmq/zmqpublishnotifier.cpp +++ b/src/zmq/zmqpublishnotifier.cpp @@ -86,6 +86,14 @@ bool CZMQAbstractPublishNotifier::Initialize(void *pcontext) return false; } + const int so_keepalive_option {1}; + rc = zmq_setsockopt(psocket, ZMQ_TCP_KEEPALIVE, &so_keepalive_option, sizeof(so_keepalive_option)); + if (rc != 0) { + zmqError("Failed to set SO_KEEPALIVE"); + zmq_close(psocket); + return false; + } + rc = zmq_bind(psocket, address.c_str()); if (rc != 0) { |