mirror of
https://github.com/Icinga/icinga2.git
synced 2025-07-22 13:14:32 +02:00
Merge pull request #7668 from Icinga/bugfix/tls-contex-copies
Fix TLS context copies in ApiListener
This commit is contained in:
commit
dc46d85ebb
@ -356,9 +356,7 @@ bool ApiListener::AddListener(const String& node, const String& service)
|
|||||||
|
|
||||||
ObjectLock olock(this);
|
ObjectLock olock(this);
|
||||||
|
|
||||||
auto sslContext (m_SSLContext);
|
if (!m_SSLContext) {
|
||||||
|
|
||||||
if (!sslContext) {
|
|
||||||
Log(LogCritical, "ApiListener", "SSL context is required for AddListener()");
|
Log(LogCritical, "ApiListener", "SSL context is required for AddListener()");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -453,16 +451,14 @@ void ApiListener::AddConnection(const Endpoint::Ptr& endpoint)
|
|||||||
namespace asio = boost::asio;
|
namespace asio = boost::asio;
|
||||||
using asio::ip::tcp;
|
using asio::ip::tcp;
|
||||||
|
|
||||||
auto sslContext (m_SSLContext);
|
if (!m_SSLContext) {
|
||||||
|
|
||||||
if (!sslContext) {
|
|
||||||
Log(LogCritical, "ApiListener", "SSL context is required for AddConnection()");
|
Log(LogCritical, "ApiListener", "SSL context is required for AddConnection()");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto& io (IoEngine::Get().GetIoContext());
|
auto& io (IoEngine::Get().GetIoContext());
|
||||||
|
|
||||||
IoEngine::SpawnCoroutine(io, [this, endpoint, &io, sslContext](asio::yield_context yc) {
|
IoEngine::SpawnCoroutine(io, [this, endpoint, &io](asio::yield_context yc) {
|
||||||
String host = endpoint->GetHost();
|
String host = endpoint->GetHost();
|
||||||
String port = endpoint->GetPort();
|
String port = endpoint->GetPort();
|
||||||
|
|
||||||
@ -470,7 +466,7 @@ void ApiListener::AddConnection(const Endpoint::Ptr& endpoint)
|
|||||||
<< "Reconnecting to endpoint '" << endpoint->GetName() << "' via host '" << host << "' and port '" << port << "'";
|
<< "Reconnecting to endpoint '" << endpoint->GetName() << "' via host '" << host << "' and port '" << port << "'";
|
||||||
|
|
||||||
try {
|
try {
|
||||||
auto sslConn (Shared<AsioTlsStream>::Make(io, *sslContext, endpoint->GetName()));
|
auto sslConn (Shared<AsioTlsStream>::Make(io, *m_SSLContext, endpoint->GetName()));
|
||||||
|
|
||||||
Connect(sslConn->lowest_layer(), host, port, yc);
|
Connect(sslConn->lowest_layer(), host, port, yc);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user