mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-02-12 11:19:08 -05:00
Merge pull request #6927
de0499d
Fix ZMQ Notification initialization and shutdown (João Barbosa)
This commit is contained in:
commit
aa03fb35c4
3 changed files with 10 additions and 6 deletions
|
@ -222,7 +222,6 @@ void Shutdown()
|
||||||
#if ENABLE_ZMQ
|
#if ENABLE_ZMQ
|
||||||
if (pzmqNotificationInterface) {
|
if (pzmqNotificationInterface) {
|
||||||
UnregisterValidationInterface(pzmqNotificationInterface);
|
UnregisterValidationInterface(pzmqNotificationInterface);
|
||||||
pzmqNotificationInterface->Shutdown();
|
|
||||||
delete pzmqNotificationInterface;
|
delete pzmqNotificationInterface;
|
||||||
pzmqNotificationInterface = NULL;
|
pzmqNotificationInterface = NULL;
|
||||||
}
|
}
|
||||||
|
@ -1180,7 +1179,6 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler)
|
||||||
pzmqNotificationInterface = CZMQNotificationInterface::CreateWithArguments(mapArgs);
|
pzmqNotificationInterface = CZMQNotificationInterface::CreateWithArguments(mapArgs);
|
||||||
|
|
||||||
if (pzmqNotificationInterface) {
|
if (pzmqNotificationInterface) {
|
||||||
pzmqNotificationInterface->Initialize();
|
|
||||||
RegisterValidationInterface(pzmqNotificationInterface);
|
RegisterValidationInterface(pzmqNotificationInterface);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -21,8 +21,7 @@ CZMQNotificationInterface::CZMQNotificationInterface() : pcontext(NULL)
|
||||||
|
|
||||||
CZMQNotificationInterface::~CZMQNotificationInterface()
|
CZMQNotificationInterface::~CZMQNotificationInterface()
|
||||||
{
|
{
|
||||||
// ensure Shutdown if Initialize is called
|
Shutdown();
|
||||||
assert(!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)
|
||||||
{
|
{
|
||||||
|
@ -59,6 +58,12 @@ CZMQNotificationInterface* CZMQNotificationInterface::CreateWithArguments(const
|
||||||
{
|
{
|
||||||
notificationInterface = new CZMQNotificationInterface();
|
notificationInterface = new CZMQNotificationInterface();
|
||||||
notificationInterface->notifiers = notifiers;
|
notificationInterface->notifiers = notifiers;
|
||||||
|
|
||||||
|
if (!notificationInterface->Initialize())
|
||||||
|
{
|
||||||
|
delete notificationInterface;
|
||||||
|
notificationInterface = NULL;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return notificationInterface;
|
return notificationInterface;
|
||||||
|
@ -99,7 +104,7 @@ bool CZMQNotificationInterface::Initialize()
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Called during shutdown sequence
|
// Called during shutdown sequence
|
||||||
|
|
|
@ -19,10 +19,11 @@ public:
|
||||||
|
|
||||||
static CZMQNotificationInterface* CreateWithArguments(const std::map<std::string, std::string> &args);
|
static CZMQNotificationInterface* CreateWithArguments(const std::map<std::string, std::string> &args);
|
||||||
|
|
||||||
|
protected:
|
||||||
bool Initialize();
|
bool Initialize();
|
||||||
void Shutdown();
|
void Shutdown();
|
||||||
|
|
||||||
protected: // CValidationInterface
|
// CValidationInterface
|
||||||
void SyncTransaction(const CTransaction &tx, const CBlock *pblock);
|
void SyncTransaction(const CTransaction &tx, const CBlock *pblock);
|
||||||
void UpdatedBlockTip(const CBlockIndex *pindex);
|
void UpdatedBlockTip(const CBlockIndex *pindex);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue