diff options
| author | mruddy <[email protected]> | 2018-08-24 20:42:03 -0400 |
|---|---|---|
| committer | mruddy <[email protected]> | 2018-10-19 07:36:13 -0400 |
| commit | a4edb168b635b6f5c36324e44961cd42cf9bbbaa (patch) | |
| tree | b3d617db74c7b1f86ee79df156139627fb7cabfe /src/zmq/zmqpublishnotifier.cpp | |
| parent | Merge #14465: tests: Stop node before removing the notification file (diff) | |
| download | discoin-a4edb168b635b6f5c36324e44961cd42cf9bbbaa.tar.xz discoin-a4edb168b635b6f5c36324e44961cd42cf9bbbaa.zip | |
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 36a6458f6..280cd1642 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); |