11 static std::multimap<std::string, CZMQAbstractPublishNotifier*> mapPublishNotifiers;
13 static const char *MSG_HASHBLOCK =
"hashblock";
14 static const char *MSG_HASHTX =
"hashtx";
15 static const char *MSG_HASHTXLOCK =
"hashtxlock";
16 static const char *MSG_RAWBLOCK =
"rawblock";
17 static const char *MSG_RAWTX =
"rawtx";
18 static const char *MSG_RAWTXLOCK =
"rawtxlock";
21 static int zmq_send_multipart(
void *sock,
const void* data,
size_t size, ...)
30 int rc = zmq_msg_init_size(&msg, size);
33 zmqError(
"Unable to initialize ZMQ msg");
37 void *buf = zmq_msg_data(&msg);
40 data = va_arg(args,
const void*);
42 rc = zmq_msg_send(&msg, sock, data ? ZMQ_SNDMORE : 0);
55 size = va_arg(args,
size_t);
65 std::multimap<std::string, CZMQAbstractPublishNotifier*>::iterator i = mapPublishNotifiers.find(
address);
67 if (i==mapPublishNotifiers.end())
69 psocket = zmq_socket(pcontext, ZMQ_PUB);
85 mapPublishNotifiers.insert(std::make_pair(
address,
this));
93 mapPublishNotifiers.insert(std::make_pair(
address,
this));
103 int count = mapPublishNotifiers.count(
address);
106 typedef std::multimap<std::string, CZMQAbstractPublishNotifier*>::iterator iterator;
107 std::pair<iterator, iterator> iterpair = mapPublishNotifiers.equal_range(
address);
109 for (iterator it = iterpair.first; it != iterpair.second; ++it)
111 if (it->second==
this)
113 mapPublishNotifiers.erase(it);
122 zmq_setsockopt(
psocket, ZMQ_LINGER, &linger,
sizeof(linger));
134 unsigned char msgseq[
sizeof(uint32_t)];
136 int rc = zmq_send_multipart(
psocket, command, strlen(command), data, size, msgseq, (
size_t)
sizeof(uint32_t), (
void*)0);
151 for (
unsigned int i = 0; i < 32; i++)
152 data[31 - i] = hash.
begin()[i];
161 for (
unsigned int i = 0; i < 32; i++)
162 data[31 - i] = hash.
begin()[i];
171 for (
unsigned int i = 0; i < 32; i++)
172 data[31 - i] = hash.
begin()[i];
188 zmqError(
"Can't read block from disk");