MXS-2483: Return std::unique_ptr from SSLContext::create

Smart pointers are far nicer than raw pointers.
This commit is contained in:
Markus Mäkelä
2019-05-21 09:12:25 +03:00
parent 5b55864b06
commit 4e2d350838
10 changed files with 33 additions and 34 deletions

View File

@ -251,7 +251,7 @@ private:
*/
Listener(SERVICE* service, const std::string& name, const std::string& address, uint16_t port,
const std::string& protocol, const std::string& authenticator,
const std::string& auth_opts, void* auth_instance, mxs::SSLContext* ssl,
const std::string& auth_opts, void* auth_instance, std::unique_ptr<mxs::SSLContext> ssl,
const MXS_CONFIG_PARAMETER& params);
/**

View File

@ -528,9 +528,9 @@ public:
}
protected:
SERVER(mxs::SSLContext* ssl_context = nullptr)
SERVER(std::unique_ptr<mxs::SSLContext> ssl_context)
: m_response_time{0.04, 0.35, 500}
, m_ssl_context{ssl_context}
, m_ssl_context{std::move(ssl_context)}
{
}

View File

@ -74,7 +74,7 @@ public:
*
* @return A new SSL configuration or nullptr on error
*/
static SSLContext* create(const MXS_CONFIG_PARAMETER& params);
static std::unique_ptr<SSLContext> create(const MXS_CONFIG_PARAMETER& params);
/**
* Serialize the SSL configuration into a INI file section