Browse Source

Merge pull request #7058

ffacd27 zmq: prepend zmq to debug messages (Daniel Cousens)
14075b1 init: add zmq to debug categories (Daniel Cousens)
cdcd816 init: amend ZMQ flag names (Daniel Cousens)
0.13
Wladimir J. van der Laan 9 years ago
parent
commit
9a3e1a59df
No known key found for this signature in database
GPG Key ID: 74810B012346C9A6
  1. 8
      src/init.cpp
  2. 6
      src/zmq/zmqnotificationinterface.cpp
  3. 10
      src/zmq/zmqpublishnotifier.cpp

8
src/init.cpp

@ -412,9 +412,9 @@ std::string HelpMessage(HelpMessageMode mode)
#if ENABLE_ZMQ #if ENABLE_ZMQ
strUsage += HelpMessageGroup(_("ZeroMQ notification options:")); strUsage += HelpMessageGroup(_("ZeroMQ notification options:"));
strUsage += HelpMessageOpt("-zmqpubhashblock=<address>", _("Enable publish hash block in <address>")); strUsage += HelpMessageOpt("-zmqpubhashblock=<address>", _("Enable publish hash block in <address>"));
strUsage += HelpMessageOpt("-zmqpubhashtransaction=<address>", _("Enable publish hash transaction in <address>")); strUsage += HelpMessageOpt("-zmqpubhashtx=<address>", _("Enable publish hash transaction in <address>"));
strUsage += HelpMessageOpt("-zmqpubrawblock=<address>", _("Enable publish raw block in <address>")); strUsage += HelpMessageOpt("-zmqpubrawblock=<address>", _("Enable publish raw block in <address>"));
strUsage += HelpMessageOpt("-zmqpubrawtransaction=<address>", _("Enable publish raw transaction in <address>")); strUsage += HelpMessageOpt("-zmqpubrawtx=<address>", _("Enable publish raw transaction in <address>"));
#endif #endif
strUsage += HelpMessageGroup(_("Debugging/Testing options:")); strUsage += HelpMessageGroup(_("Debugging/Testing options:"));
@ -437,7 +437,7 @@ std::string HelpMessage(HelpMessageMode mode)
strUsage += HelpMessageOpt("-limitdescendantcount=<n>", strprintf("Do not accept transactions if any ancestor would have <n> or more in-mempool descendants (default: %u)", DEFAULT_DESCENDANT_LIMIT)); strUsage += HelpMessageOpt("-limitdescendantcount=<n>", strprintf("Do not accept transactions if any ancestor would have <n> or more in-mempool descendants (default: %u)", DEFAULT_DESCENDANT_LIMIT));
strUsage += HelpMessageOpt("-limitdescendantsize=<n>", strprintf("Do not accept transactions if any ancestor would have more than <n> kilobytes of in-mempool descendants (default: %u).", DEFAULT_DESCENDANT_SIZE_LIMIT)); strUsage += HelpMessageOpt("-limitdescendantsize=<n>", strprintf("Do not accept transactions if any ancestor would have more than <n> kilobytes of in-mempool descendants (default: %u).", DEFAULT_DESCENDANT_SIZE_LIMIT));
} }
string debugCategories = "addrman, alert, bench, coindb, db, lock, rand, rpc, selectcoins, mempool, mempoolrej, net, proxy, prune, http, libevent"; // Don't translate these and qt below string debugCategories = "addrman, alert, bench, coindb, db, lock, rand, rpc, selectcoins, mempool, mempoolrej, net, proxy, prune, http, libevent, zmq"; // Don't translate these and qt below
if (mode == HMM_BITCOIN_QT) if (mode == HMM_BITCOIN_QT)
debugCategories += ", qt"; debugCategories += ", qt";
strUsage += HelpMessageOpt("-debug=<category>", strprintf(_("Output debugging information (default: %u, supplying <category> is optional)"), 0) + ". " + strUsage += HelpMessageOpt("-debug=<category>", strprintf(_("Output debugging information (default: %u, supplying <category> is optional)"), 0) + ". " +
@ -834,7 +834,7 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler)
LogPrintf("%s: parameter interaction: -blocksonly=1 -> setting -walletbroadcast=0\n", __func__); LogPrintf("%s: parameter interaction: -blocksonly=1 -> setting -walletbroadcast=0\n", __func__);
#endif #endif
} }
// Make sure enough file descriptors are available // Make sure enough file descriptors are available
int nBind = std::max((int)mapArgs.count("-bind") + (int)mapArgs.count("-whitebind"), 1); int nBind = std::max((int)mapArgs.count("-bind") + (int)mapArgs.count("-whitebind"), 1);
int nUserMaxConnections = GetArg("-maxconnections", DEFAULT_MAX_PEER_CONNECTIONS); int nUserMaxConnections = GetArg("-maxconnections", DEFAULT_MAX_PEER_CONNECTIONS);

6
src/zmq/zmqnotificationinterface.cpp

@ -12,7 +12,7 @@
void zmqError(const char *str) void zmqError(const char *str)
{ {
LogPrint("zmq", "Error: %s, errno=%s\n", str, zmq_strerror(errno)); LogPrint("zmq", "zmq: Error: %s, errno=%s\n", str, zmq_strerror(errno));
} }
CZMQNotificationInterface::CZMQNotificationInterface() : pcontext(NULL) CZMQNotificationInterface::CZMQNotificationInterface() : pcontext(NULL)
@ -72,7 +72,7 @@ CZMQNotificationInterface* CZMQNotificationInterface::CreateWithArguments(const
// Called at startup to conditionally set up ZMQ socket(s) // Called at startup to conditionally set up ZMQ socket(s)
bool CZMQNotificationInterface::Initialize() bool CZMQNotificationInterface::Initialize()
{ {
LogPrint("zmq", "Initialize notification interface\n"); LogPrint("zmq", "zmq: Initialize notification interface\n");
assert(!pcontext); assert(!pcontext);
pcontext = zmq_init(1); pcontext = zmq_init(1);
@ -110,7 +110,7 @@ bool CZMQNotificationInterface::Initialize()
// Called during shutdown sequence // Called during shutdown sequence
void CZMQNotificationInterface::Shutdown() void CZMQNotificationInterface::Shutdown()
{ {
LogPrint("zmq", "Shutdown notification interface\n"); LogPrint("zmq", "zmq: Shutdown notification interface\n");
if (pcontext) if (pcontext)
{ {
for (std::list<CZMQAbstractNotifier*>::iterator i=notifiers.begin(); i!=notifiers.end(); ++i) for (std::list<CZMQAbstractNotifier*>::iterator i=notifiers.begin(); i!=notifiers.end(); ++i)

10
src/zmq/zmqpublishnotifier.cpp

@ -78,7 +78,7 @@ bool CZMQAbstractPublishNotifier::Initialize(void *pcontext)
} }
else else
{ {
LogPrint("zmq", " Reuse socket for address %s\n", address); LogPrint("zmq", "zmq: Reusing socket for address %s\n", address);
psocket = i->second->psocket; psocket = i->second->psocket;
mapPublishNotifiers.insert(std::make_pair(address, this)); mapPublishNotifiers.insert(std::make_pair(address, this));
@ -120,7 +120,7 @@ void CZMQAbstractPublishNotifier::Shutdown()
bool CZMQPublishHashBlockNotifier::NotifyBlock(const CBlockIndex *pindex) bool CZMQPublishHashBlockNotifier::NotifyBlock(const CBlockIndex *pindex)
{ {
uint256 hash = pindex->GetBlockHash(); uint256 hash = pindex->GetBlockHash();
LogPrint("zmq", "Publish hash block %s\n", hash.GetHex()); LogPrint("zmq", "zmq: Publish hashblock %s\n", hash.GetHex());
char data[32]; char data[32];
for (unsigned int i = 0; i < 32; i++) for (unsigned int i = 0; i < 32; i++)
data[31 - i] = hash.begin()[i]; data[31 - i] = hash.begin()[i];
@ -131,7 +131,7 @@ bool CZMQPublishHashBlockNotifier::NotifyBlock(const CBlockIndex *pindex)
bool CZMQPublishHashTransactionNotifier::NotifyTransaction(const CTransaction &transaction) bool CZMQPublishHashTransactionNotifier::NotifyTransaction(const CTransaction &transaction)
{ {
uint256 hash = transaction.GetHash(); uint256 hash = transaction.GetHash();
LogPrint("zmq", "Publish hash transaction %s\n", hash.GetHex()); LogPrint("zmq", "zmq: Publish hashtx %s\n", hash.GetHex());
char data[32]; char data[32];
for (unsigned int i = 0; i < 32; i++) for (unsigned int i = 0; i < 32; i++)
data[31 - i] = hash.begin()[i]; data[31 - i] = hash.begin()[i];
@ -141,7 +141,7 @@ bool CZMQPublishHashTransactionNotifier::NotifyTransaction(const CTransaction &t
bool CZMQPublishRawBlockNotifier::NotifyBlock(const CBlockIndex *pindex) bool CZMQPublishRawBlockNotifier::NotifyBlock(const CBlockIndex *pindex)
{ {
LogPrint("zmq", "Publish raw block %s\n", pindex->GetBlockHash().GetHex()); LogPrint("zmq", "zmq: Publish rawblock %s\n", pindex->GetBlockHash().GetHex());
const Consensus::Params& consensusParams = Params().GetConsensus(); const Consensus::Params& consensusParams = Params().GetConsensus();
CDataStream ss(SER_NETWORK, PROTOCOL_VERSION); CDataStream ss(SER_NETWORK, PROTOCOL_VERSION);
@ -164,7 +164,7 @@ bool CZMQPublishRawBlockNotifier::NotifyBlock(const CBlockIndex *pindex)
bool CZMQPublishRawTransactionNotifier::NotifyTransaction(const CTransaction &transaction) bool CZMQPublishRawTransactionNotifier::NotifyTransaction(const CTransaction &transaction)
{ {
uint256 hash = transaction.GetHash(); uint256 hash = transaction.GetHash();
LogPrint("zmq", "Publish raw transaction %s\n", hash.GetHex()); LogPrint("zmq", "zmq: Publish rawtx %s\n", hash.GetHex());
CDataStream ss(SER_NETWORK, PROTOCOL_VERSION); CDataStream ss(SER_NETWORK, PROTOCOL_VERSION);
ss << transaction; ss << transaction;
int rc = zmq_send_multipart(psocket, "rawtx", 5, &(*ss.begin()), ss.size(), 0); int rc = zmq_send_multipart(psocket, "rawtx", 5, &(*ss.begin()), ss.size(), 0);

Loading…
Cancel
Save