MCPcopy Create free account
hub / github.com/ElementsProject/elements / Initialize

Method Initialize

src/zmq/zmqnotificationinterface.cpp:69–96  ·  view source on GitHub ↗

Called at startup to conditionally set up ZMQ socket(s)

Source from the content-addressed store, hash-verified

67
68// Called at startup to conditionally set up ZMQ socket(s)
69bool 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
99void CZMQNotificationInterface::Shutdown()

Callers 1

CreateMethod · 0.45

Calls 3

zmqErrorFunction · 0.85
GetAddressMethod · 0.80
GetTypeMethod · 0.45

Tested by

no test coverage detected