aboutsummaryrefslogtreecommitdiff
path: root/src/zmq
diff options
context:
space:
mode:
authormruddy <6440430+mruddy@users.noreply.github.com>2018-11-08 06:38:21 -0500
committermruddy <6440430+mruddy@users.noreply.github.com>2018-11-15 08:16:25 -0500
commitc276df775914e4e42993c76e172ef159e3b830d4 (patch)
tree8bba4fee9755974b946a1d95aac811aa1c8b61e0 /src/zmq
parente74649e95122c9c61aadf607461cf701c3953f88 (diff)
zmq: enable tcp keepalive
Diffstat (limited to 'src/zmq')
-rw-r--r--src/zmq/zmqpublishnotifier.cpp8
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)
{