Skip to content

Commit

Permalink
[depends, zmq, doc] avoid deprecated zeromq api functions
Browse files Browse the repository at this point in the history
Zcash: Backported from bitcoin/bitcoin#13578
  • Loading branch information
mruddy authored and str4d committed Oct 5, 2020
1 parent 92aa4d6 commit edfb4d9
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
7 changes: 4 additions & 3 deletions doc/zmq.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,10 @@ buffering or reassembly.

## Prerequisites

The ZeroMQ feature in Zcash requires ZeroMQ API version 4.x or
newer, which you will need to install if you are not using the depends
system. Typically, it is packaged by distributions as something like
The ZeroMQ feature in Zcash requires the ZeroMQ API >= 4.0.0
[libzmq](https://github.com/zeromq/libzmq/releases), which you will
need to install if you are not using the depends system.
Typically, it is packaged by distributions as something like
*libzmq5-dev*. The C++ wrapper for ZeroMQ is *not* needed.

In order to run the example Python client scripts in contrib/ one must
Expand Down
8 changes: 6 additions & 2 deletions src/zmq/zmqnotificationinterface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,14 @@ CZMQNotificationInterface* CZMQNotificationInterface::CreateWithArguments(const
// Called at startup to conditionally set up ZMQ socket(s)
bool CZMQNotificationInterface::Initialize()
{
int major = 0, minor = 0, patch = 0;
zmq_version(&major, &minor, &patch);
LogPrint("zmq", "zmq: version %d.%d.%d\n", major, minor, patch);

LogPrint("zmq", "zmq: Initialize notification interface\n");
assert(!pcontext);

pcontext = zmq_init(1);
pcontext = zmq_ctx_new();

if (!pcontext)
{
Expand Down Expand Up @@ -119,7 +123,7 @@ void CZMQNotificationInterface::Shutdown()
LogPrint("zmq", " Shutdown notifier %s at %s\n", notifier->GetType(), notifier->GetAddress());
notifier->Shutdown();
}
zmq_ctx_destroy(pcontext);
zmq_ctx_term(pcontext);

pcontext = 0;
}
Expand Down

0 comments on commit edfb4d9

Please sign in to comment.