@ -45,8 +45,8 @@ enum
|
|||||||
|
|
||||||
struct Ssl
|
struct Ssl
|
||||||
{
|
{
|
||||||
SSL_CTX *m_context;
|
SSL_CTX *m_context = nullptr;
|
||||||
SSL *m_ssl;
|
SSL *m_ssl = nullptr;
|
||||||
};
|
};
|
||||||
|
|
||||||
static int verifyIgnoreCertCallback(X509_STORE_CTX *, void *)
|
static int verifyIgnoreCertCallback(X509_STORE_CTX *, void *)
|
||||||
@ -289,9 +289,7 @@ void SecureSocket::initSsl(bool server)
|
|||||||
{
|
{
|
||||||
std::scoped_lock ssl_lock{ssl_mutex_};
|
std::scoped_lock ssl_lock{ssl_mutex_};
|
||||||
|
|
||||||
m_ssl = new Ssl();
|
m_ssl = std::make_unique<Ssl>();
|
||||||
m_ssl->m_context = nullptr;
|
|
||||||
m_ssl->m_ssl = nullptr;
|
|
||||||
|
|
||||||
initContext(server);
|
initContext(server);
|
||||||
}
|
}
|
||||||
@ -407,7 +405,6 @@ void SecureSocket::freeSSL()
|
|||||||
SSL_CTX_free(m_ssl->m_context);
|
SSL_CTX_free(m_ssl->m_context);
|
||||||
m_ssl->m_context = nullptr;
|
m_ssl->m_context = nullptr;
|
||||||
}
|
}
|
||||||
delete m_ssl;
|
|
||||||
m_ssl = nullptr;
|
m_ssl = nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -11,6 +11,8 @@
|
|||||||
#include "net/SecurityLevel.h"
|
#include "net/SecurityLevel.h"
|
||||||
#include "net/TCPSocket.h"
|
#include "net/TCPSocket.h"
|
||||||
#include "net/XSocket.h"
|
#include "net/XSocket.h"
|
||||||
|
|
||||||
|
#include <memory>
|
||||||
#include <mutex>
|
#include <mutex>
|
||||||
|
|
||||||
class IEventQueue;
|
class IEventQueue;
|
||||||
@ -91,7 +93,7 @@ private:
|
|||||||
// by it.
|
// by it.
|
||||||
std::mutex ssl_mutex_;
|
std::mutex ssl_mutex_;
|
||||||
|
|
||||||
Ssl *m_ssl = nullptr;
|
std::unique_ptr<Ssl> m_ssl;
|
||||||
bool m_secureReady = false;
|
bool m_secureReady = false;
|
||||||
bool m_fatal = false;
|
bool m_fatal = false;
|
||||||
SecurityLevel m_securityLevel = SecurityLevel::Encrypted;
|
SecurityLevel m_securityLevel = SecurityLevel::Encrypted;
|
||||||
|
|||||||
Reference in New Issue
Block a user