MXS-2196: Use smart pointers for lifetime management

The listeners no longer internally track whether they are active or
not. All of the heavy lifting is now done by std::shared_ptr.
This commit is contained in:
Markus Mäkelä
2018-11-30 11:53:17 +02:00
parent a10b6c2e89
commit c858f7f080
3 changed files with 20 additions and 60 deletions

View File

@ -63,6 +63,16 @@ public:
const std::string& auth_options,
SSL_LISTENER* ssl);
/**
* Destroy a listener
*
* This removes the listener from the global list of active listeners. Once destroyed, the port used
* by a listener is open for immediate reuse.
*
* @param listener Listener to destroy
*/
static void destroy(const SListener& listener);
/**
* Start listening on the configured port
*
@ -84,14 +94,6 @@ public:
*/
bool start();
/**
* Closes a listener
*
* This closes the network socket the listener listens on to allow immediate reuse of it. The listener
* instance can remain if there are open sessions for it.
*/
void close();
/**
* Listener name
*/
@ -132,18 +134,6 @@ public:
*/
const char* state() const;
/**
* Whether the listener is active
*/
bool is_active() const;
/**
* Deactivate the listener
*
* TODO: Remove and deactivate via removal from global listener list
*/
void deactivate();
/**
* The SSL_LISTENER object
*/
@ -221,15 +211,6 @@ private:
*/
bool listener_serialize(const SListener& listener);
/**
* @brief Free a listener
*
* The listener must be destroyed before it can be freed.
*
* @param listener Listener to free
*/
void listener_free(const SListener& listener);
/**
* Find a listener
*