From caac39b0ace38aa088d88c1a5a9a9dbb4d2e893f Mon Sep 17 00:00:00 2001 From: Daniel Kraft Date: Fri, 29 Jun 2018 15:16:31 +0200 Subject: Make ZMQ notification interface instance global. This moves the used instance of CZMQNotificationInterface from a static variable in init.cpp to a globally-accessible one declared in zmq/zmqnotificationinterface.h. The variable is also renamed to g_zmq_notification_interface, to be consistent with other globals. We need this to implement a new RPC method "getzmqnotifications" (see https://github.com/bitcoin/bitcoin/issues/13526) in a follow up. --- src/zmq/zmqnotificationinterface.cpp | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/zmq/zmqnotificationinterface.cpp') diff --git a/src/zmq/zmqnotificationinterface.cpp b/src/zmq/zmqnotificationinterface.cpp index 68b425fa08..89ae62f4cb 100644 --- a/src/zmq/zmqnotificationinterface.cpp +++ b/src/zmq/zmqnotificationinterface.cpp @@ -180,3 +180,5 @@ void CZMQNotificationInterface::BlockDisconnected(const std::shared_ptr Date: Fri, 29 Jun 2018 16:10:01 +0200 Subject: RPC: Add new getzmqnotifications method. This adds a new RPC method "getzmqnotifications", which returns information about all active ZMQ notification endpoints. This is useful for software that layers on top of bitcoind, so it can verify that ZeroMQ is enabled and also figure out where it should listen. See https://github.com/bitcoin/bitcoin/issues/13526. --- src/zmq/zmqnotificationinterface.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'src/zmq/zmqnotificationinterface.cpp') diff --git a/src/zmq/zmqnotificationinterface.cpp b/src/zmq/zmqnotificationinterface.cpp index 89ae62f4cb..8cbc969972 100644 --- a/src/zmq/zmqnotificationinterface.cpp +++ b/src/zmq/zmqnotificationinterface.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2015-2017 The Bitcoin Core developers +// Copyright (c) 2015-2018 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. @@ -29,6 +29,15 @@ CZMQNotificationInterface::~CZMQNotificationInterface() } } +std::list CZMQNotificationInterface::GetActiveNotifiers() const +{ + std::list result; + for (const auto* n : notifiers) { + result.push_back(n); + } + return result; +} + CZMQNotificationInterface* CZMQNotificationInterface::Create() { CZMQNotificationInterface* notificationInterface = nullptr; -- cgit v1.2.3