diff options
author | mruddy <6440430+mruddy@users.noreply.github.com> | 2018-08-24 20:42:03 -0400 |
---|---|---|
committer | mruddy <6440430+mruddy@users.noreply.github.com> | 2018-10-19 07:36:13 -0400 |
commit | a4edb168b635b6f5c36324e44961cd42cf9bbbaa (patch) | |
tree | b3d617db74c7b1f86ee79df156139627fb7cabfe /src/zmq/zmqpublishnotifier.cpp | |
parent | d387507aeca652a5569825af65243536f2ce26ea (diff) | |
download | bitcoin-a4edb168b635b6f5c36324e44961cd42cf9bbbaa.tar.xz |
ZMQ: add options to configure outbound message high water mark, aka SNDHWM
Diffstat (limited to 'src/zmq/zmqpublishnotifier.cpp')
-rw-r--r-- | src/zmq/zmqpublishnotifier.cpp | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/src/zmq/zmqpublishnotifier.cpp b/src/zmq/zmqpublishnotifier.cpp index 36a6458f67..280cd1642e 100644 --- a/src/zmq/zmqpublishnotifier.cpp +++ b/src/zmq/zmqpublishnotifier.cpp @@ -76,8 +76,18 @@ bool CZMQAbstractPublishNotifier::Initialize(void *pcontext) return false; } - int rc = zmq_bind(psocket, address.c_str()); - if (rc!=0) + LogPrint(BCLog::ZMQ, "zmq: Outbound message high water mark for %s at %s is %d\n", type, address, outbound_message_high_water_mark); + + int rc = zmq_setsockopt(psocket, ZMQ_SNDHWM, &outbound_message_high_water_mark, sizeof(outbound_message_high_water_mark)); + if (rc != 0) + { + zmqError("Failed to set outbound message high water mark"); + zmq_close(psocket); + return false; + } + + rc = zmq_bind(psocket, address.c_str()); + if (rc != 0) { zmqError("Failed to bind address"); zmq_close(psocket); @@ -120,7 +130,7 @@ void CZMQAbstractPublishNotifier::Shutdown() if (count == 1) { - LogPrint(BCLog::ZMQ, "Close socket at address %s\n", address); + LogPrint(BCLog::ZMQ, "zmq: Close socket at address %s\n", address); int linger = 0; zmq_setsockopt(psocket, ZMQ_LINGER, &linger, sizeof(linger)); zmq_close(psocket); |