Browse Source

Merge pull request #6927

de0499d Fix ZMQ Notification initialization and shutdown (João Barbosa)
0.13
Wladimir J. van der Laan 9 years ago
parent
commit
aa03fb35c4
No known key found for this signature in database
GPG Key ID: 74810B012346C9A6
  1. 2
      src/init.cpp
  2. 11
      src/zmq/zmqnotificationinterface.cpp
  3. 3
      src/zmq/zmqnotificationinterface.h

2
src/init.cpp

@ -222,7 +222,6 @@ void Shutdown() @@ -222,7 +222,6 @@ void Shutdown()
#if ENABLE_ZMQ
if (pzmqNotificationInterface) {
UnregisterValidationInterface(pzmqNotificationInterface);
pzmqNotificationInterface->Shutdown();
delete pzmqNotificationInterface;
pzmqNotificationInterface = NULL;
}
@ -1180,7 +1179,6 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler) @@ -1180,7 +1179,6 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler)
pzmqNotificationInterface = CZMQNotificationInterface::CreateWithArguments(mapArgs);
if (pzmqNotificationInterface) {
pzmqNotificationInterface->Initialize();
RegisterValidationInterface(pzmqNotificationInterface);
}
#endif

11
src/zmq/zmqnotificationinterface.cpp

@ -21,8 +21,7 @@ CZMQNotificationInterface::CZMQNotificationInterface() : pcontext(NULL) @@ -21,8 +21,7 @@ CZMQNotificationInterface::CZMQNotificationInterface() : pcontext(NULL)
CZMQNotificationInterface::~CZMQNotificationInterface()
{
// ensure Shutdown if Initialize is called
assert(!pcontext);
Shutdown();
for (std::list<CZMQAbstractNotifier*>::iterator i=notifiers.begin(); i!=notifiers.end(); ++i)
{
@ -59,6 +58,12 @@ CZMQNotificationInterface* CZMQNotificationInterface::CreateWithArguments(const @@ -59,6 +58,12 @@ CZMQNotificationInterface* CZMQNotificationInterface::CreateWithArguments(const
{
notificationInterface = new CZMQNotificationInterface();
notificationInterface->notifiers = notifiers;
if (!notificationInterface->Initialize())
{
delete notificationInterface;
notificationInterface = NULL;
}
}
return notificationInterface;
@ -99,7 +104,7 @@ bool CZMQNotificationInterface::Initialize() @@ -99,7 +104,7 @@ bool CZMQNotificationInterface::Initialize()
return false;
}
return false;
return true;
}
// Called during shutdown sequence

3
src/zmq/zmqnotificationinterface.h

@ -19,10 +19,11 @@ public: @@ -19,10 +19,11 @@ public:
static CZMQNotificationInterface* CreateWithArguments(const std::map<std::string, std::string> &args);
protected:
bool Initialize();
void Shutdown();
protected: // CValidationInterface
// CValidationInterface
void SyncTransaction(const CTransaction &tx, const CBlock *pblock);
void UpdatedBlockTip(const CBlockIndex *pindex);

Loading…
Cancel
Save