Called at startup to conditionally set up ZMQ socket(s)
| 67 | |
| 68 | // Called at startup to conditionally set up ZMQ socket(s) |
| 69 | bool CZMQNotificationInterface::Initialize() |
| 70 | { |
| 71 | int major = 0, minor = 0, patch = 0; |
| 72 | zmq_version(&major, &minor, &patch); |
| 73 | LogPrint(BCLog::ZMQ, "zmq: version %d.%d.%d\n", major, minor, patch); |
| 74 | |
| 75 | LogPrint(BCLog::ZMQ, "zmq: Initialize notification interface\n"); |
| 76 | assert(!pcontext); |
| 77 | |
| 78 | pcontext = zmq_ctx_new(); |
| 79 | |
| 80 | if (!pcontext) |
| 81 | { |
| 82 | zmqError("Unable to initialize context"); |
| 83 | return false; |
| 84 | } |
| 85 | |
| 86 | for (auto& notifier : notifiers) { |
| 87 | if (notifier->Initialize(pcontext)) { |
| 88 | LogPrint(BCLog::ZMQ, "zmq: Notifier %s ready (address = %s)\n", notifier->GetType(), notifier->GetAddress()); |
| 89 | } else { |
| 90 | LogPrint(BCLog::ZMQ, "zmq: Notifier %s failed (address = %s)\n", notifier->GetType(), notifier->GetAddress()); |
| 91 | return false; |
| 92 | } |
| 93 | } |
| 94 | |
| 95 | return true; |
| 96 | } |
| 97 | |
| 98 | // Called during shutdown sequence |
| 99 | void CZMQNotificationInterface::Shutdown() |
no test coverage detected