From 33a87469c02989cac6c7c206548ed0caf1a411c3 Mon Sep 17 00:00:00 2001 From: moneromooo-monero Date: Sat, 31 Oct 2015 10:09:24 +0000 Subject: [PATCH] daemon_ipc_handlers: ctor/dtor cleanup Reset pointers to NULL when stopped, stop if trying to init a non stop server, remove copy pasted doc block that doesn't make sense for stop. --- src/ipc/daemon_ipc_handlers.cpp | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/src/ipc/daemon_ipc_handlers.cpp b/src/ipc/daemon_ipc_handlers.cpp index c86536fcd..c5de1663f 100644 --- a/src/ipc/daemon_ipc_handlers.cpp +++ b/src/ipc/daemon_ipc_handlers.cpp @@ -47,11 +47,11 @@ */ namespace { - cryptonote::core *core; /*!< Pointer to the core */ - nodetool::node_server > *p2p; + cryptonote::core *core = NULL; /*!< Pointer to the core */ + nodetool::node_server > *p2p = NULL; /*!< Pointer to p2p node server */ - zactor_t *server; /*!< 0MQ server */ - bool testnet; /*!< testnet mode or not */ + zactor_t *server = NULL; /*!< 0MQ server */ + bool testnet = false; /*!< testnet mode or not */ /*! * \brief Checks if core is busy @@ -126,6 +126,8 @@ namespace IPC nodetool::node_server > &p_p2p, bool p_testnet) { + if (server) + stop(); p2p = &p_p2p; core = &p_core; testnet = p_testnet; @@ -136,13 +138,12 @@ namespace IPC /*! * \brief stops the IPC server - * - * \param p_core cryptonote core object - * \param p_p2p p2p object - * \param p_testnet testnet mode or not */ void stop() { zactor_destroy(&server); + server = NULL; + p2p = NULL; + core = NULL; } /*!