MXS-2483: Fix dcb.hh includes
The header depended on ssl.hh to include the OpenSSL headers even though it used OpenSSL types. By fixing these dependencies the ssl.h header can now freely include the rworker_local type which removes the need for the hidden implementation of SSLProvider.
This commit is contained in:
parent
d5ec357731
commit
c2975d33f8
@ -17,13 +17,15 @@
|
||||
*/
|
||||
|
||||
#include <maxscale/ccdefs.hh>
|
||||
|
||||
#include <openssl/ssl.h>
|
||||
#include <netinet/in.h>
|
||||
|
||||
#include <maxbase/poll.h>
|
||||
#include <maxscale/authenticator.hh>
|
||||
#include <maxscale/buffer.hh>
|
||||
#include <maxscale/modinfo.h>
|
||||
#include <maxscale/protocol.hh>
|
||||
#include <maxscale/ssl.hh>
|
||||
|
||||
#include <memory>
|
||||
|
||||
|
@ -22,6 +22,7 @@
|
||||
|
||||
#include <maxscale/protocol.hh>
|
||||
#include <maxscale/modinfo.h>
|
||||
#include <maxscale/routingworker.hh>
|
||||
|
||||
#include <openssl/crypto.h>
|
||||
#include <openssl/ssl.h>
|
||||
@ -142,14 +143,14 @@ private:
|
||||
class SSLProvider
|
||||
{
|
||||
public:
|
||||
SSLProvider(std::unique_ptr<mxs::SSLContext> context);
|
||||
|
||||
const mxs::SSLConfig& config() const;
|
||||
mxs::SSLContext* context() const;
|
||||
void set_context(std::unique_ptr<mxs::SSLContext> ssl);
|
||||
|
||||
SSLProvider(std::unique_ptr<mxs::SSLContext>&& context);
|
||||
~SSLProvider();
|
||||
|
||||
private:
|
||||
std::unique_ptr<SSLProviderImp> m_imp;
|
||||
mxs::rworker_local<std::shared_ptr<mxs::SSLContext>> m_context; /**< SSL context */
|
||||
mxs::SSLConfig m_config; /**< SSL configuration */
|
||||
};
|
||||
}
|
||||
|
@ -197,45 +197,6 @@ static const char* get_ssl_errors()
|
||||
return ssl_errbuf->c_str();
|
||||
}
|
||||
|
||||
class SSLProviderImp
|
||||
{
|
||||
public:
|
||||
const mxs::SSLConfig& config() const;
|
||||
mxs::SSLContext* context() const;
|
||||
void set_context(std::unique_ptr<mxs::SSLContext> ssl);
|
||||
|
||||
SSLProviderImp(std::unique_ptr<mxs::SSLContext>&& context);
|
||||
|
||||
private:
|
||||
mxs::rworker_local<std::shared_ptr<mxs::SSLContext>> m_context; /**< SSL context */
|
||||
mxs::SSLConfig m_config; /**< SSL configuration */
|
||||
};
|
||||
|
||||
const mxs::SSLConfig& SSLProviderImp::config() const
|
||||
{
|
||||
return m_config;
|
||||
}
|
||||
|
||||
mxs::SSLContext* SSLProviderImp::context() const
|
||||
{
|
||||
mxb_assert_message(mxs::RoutingWorker::get_current(), "Must be used on a RoutingWorker");
|
||||
return m_context->get();
|
||||
}
|
||||
|
||||
void SSLProviderImp::set_context(std::unique_ptr<mxs::SSLContext> ssl)
|
||||
{
|
||||
mxb_assert_message(mxs::RoutingWorker::get_current()
|
||||
== mxs::RoutingWorker::get(mxs::RoutingWorker::MAIN),
|
||||
"Must be only set on the main RoutingWorker");
|
||||
m_config = ssl ? ssl->config() : mxs::SSLConfig {};
|
||||
m_context.assign(std::move(ssl));
|
||||
}
|
||||
|
||||
SSLProviderImp::SSLProviderImp(std::unique_ptr<mxs::SSLContext>&& context)
|
||||
: m_context {std::move(context)}
|
||||
{
|
||||
}
|
||||
|
||||
namespace maxscale
|
||||
{
|
||||
|
||||
@ -453,27 +414,28 @@ SSLContext::~SSLContext()
|
||||
SSL_CTX_free(m_ctx);
|
||||
}
|
||||
|
||||
SSLProvider::SSLProvider(std::unique_ptr<mxs::SSLContext>&& ssl)
|
||||
: m_imp(new SSLProviderImp(std::move(ssl)))
|
||||
{
|
||||
}
|
||||
|
||||
SSLProvider::~SSLProvider()
|
||||
SSLProvider::SSLProvider(std::unique_ptr<mxs::SSLContext> context)
|
||||
: m_context {std::move(context)}
|
||||
{
|
||||
}
|
||||
|
||||
mxs::SSLContext* SSLProvider::context() const
|
||||
{
|
||||
return m_imp->context();
|
||||
mxb_assert_message(mxs::RoutingWorker::get_current(), "Must be used on a RoutingWorker");
|
||||
return m_context->get();
|
||||
}
|
||||
|
||||
const mxs::SSLConfig& SSLProvider::config() const
|
||||
{
|
||||
return m_imp->config();
|
||||
return m_config;
|
||||
}
|
||||
|
||||
void SSLProvider::set_context(std::unique_ptr<mxs::SSLContext> ssl)
|
||||
{
|
||||
m_imp->set_context(std::move(ssl));
|
||||
mxb_assert_message(mxs::RoutingWorker::get_current()
|
||||
== mxs::RoutingWorker::get(mxs::RoutingWorker::MAIN),
|
||||
"Must be only set on the main RoutingWorker");
|
||||
m_config = ssl ? ssl->config() : mxs::SSLConfig {};
|
||||
m_context.assign(std::move(ssl));
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user