No description provided.
Fix ZMQ Notification initialization and shutdown #6927
pull promag wants to merge 1 commits into bitcoin:master from uphold:bugfix/zmq-initialization-shutdown changing 3 files +10 −6-
promag commented at 6:16 PM on November 1, 2015: member
-
laanwj commented at 2:39 AM on November 2, 2015: member
Can you explain what is the issue that this is fixing, and how it fixes it?
-
in src/zmq/zmqnotificationinterface.cpp:None in 7695f9a73a outdated
103 | @@ -99,7 +104,7 @@ bool CZMQNotificationInterface::Initialize() 104 | return false; 105 | } 106 | 107 | - return false; 108 | + return true;
in src/init.cpp:None in 7695f9a73a outdated
1174 | @@ -1176,7 +1175,6 @@ bool AppInit2(boost::thread_group& threadGroup, CScheduler& scheduler) 1175 | pzmqNotificationInterface = CZMQNotificationInterface::CreateWithArguments(mapArgs); 1176 | 1177 | if (pzmqNotificationInterface) { 1178 | - pzmqNotificationInterface->Initialize();
in src/zmq/zmqnotificationinterface.cpp:None in 7695f9a73a outdated
57 | @@ -59,6 +58,12 @@ CZMQNotificationInterface* CZMQNotificationInterface::CreateWithArguments(const 58 | { 59 | notificationInterface = new CZMQNotificationInterface(); 60 | notificationInterface->notifiers = notifiers; 61 | + 62 | + if (!notificationInterface->Initialize())
in src/zmq/zmqnotificationinterface.cpp:None in 7695f9a73a outdated
20 | @@ -21,8 +21,7 @@ CZMQNotificationInterface::CZMQNotificationInterface() : pcontext(NULL) 21 | 22 | CZMQNotificationInterface::~CZMQNotificationInterface() 23 | { 24 | - // ensure Shutdown if Initialize is called 25 | - assert(!pcontext); 26 | + Shutdown();
in src/zmq/zmqnotificationinterface.h:None in 7695f9a73a outdated
18 | @@ -19,10 +19,11 @@ class CZMQNotificationInterface : public CValidationInterface 19 | 20 | static CZMQNotificationInterface* CreateWithArguments(const std::map<std::string, std::string> &args); 21 | 22 | +protected: 23 | bool Initialize();
laanwj commented at 11:31 AM on November 2, 2015: memberAgree re: Initialize/Shutdown. As Initialize is always immediately called after the constructor and Shutdown before the destructor it makes little sense to require these to be called explicitly (and have it possible for the object to be in 'created but uninitialized' state.
jonasschnelli commented at 7:28 PM on November 3, 2015: contributorCodereview ACK. Makes sense to use the destructor instead
init.cpppollution. This also fixes a possible tiny-shutdown-only memory leak in case of something went wrong during initialization.laanwj commented at 10:33 AM on November 4, 2015: memberutACK.
Please do include more information in your commit message. With an empty description, someone browsing git in the future will not be able to understand the reasoning behind your change.
laanwj added the label Refactoring on Nov 4, 2015de0499d3b8Fix ZMQ Notification initialization and shutdown
Moves the call Initialize() from init.cpp to CreateWithArguments() and handles the return value. Moves the call Shutdown() from init.cpp to destructor. Changes Initialize() and Shutdown() to protected members.
promag force-pushed on Nov 4, 2015laanwj merged this on Nov 4, 2015laanwj closed this on Nov 4, 2015laanwj referenced this in commit aa03fb35c4 on Nov 4, 2015luke-jr referenced this in commit e63528ce07 on Nov 27, 2015zkbot referenced this in commit 36df5a92f8 on Feb 9, 2017zkbot referenced this in commit dd8b38316f on Feb 9, 2017zkbot referenced this in commit 253c610783 on Feb 9, 2017DrahtBot locked this on Sep 8, 2021ContributorsLabels
github-metadata-mirror
This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-04-22 00:15 UTC
This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me