mirror of https://github.com/Icinga/icinga2.git
parent
c3b365dc62
commit
3c6ca2957b
|
@ -153,11 +153,13 @@ SocketEvents::SocketEvents(const Socket::Ptr& socket)
|
|||
|
||||
SocketEvents::~SocketEvents(void)
|
||||
{
|
||||
Unregister();
|
||||
ASSERT(m_FD == INVALID_SOCKET);
|
||||
}
|
||||
|
||||
void SocketEvents::Register(void)
|
||||
{
|
||||
ASSERT(m_FD != INVALID_SOCKET);
|
||||
|
||||
SocketEventDescriptor desc;
|
||||
desc.Events = 0;
|
||||
desc.EventInterface = this;
|
||||
|
@ -165,6 +167,8 @@ void SocketEvents::Register(void)
|
|||
{
|
||||
boost::mutex::scoped_lock lock(l_SocketIOMutex);
|
||||
|
||||
ASSERT(l_SocketIOSockets.find(m_FD) == l_SocketIOSockets.end());
|
||||
|
||||
l_SocketIOSockets[m_FD] = desc;
|
||||
}
|
||||
|
||||
|
@ -173,17 +177,23 @@ void SocketEvents::Register(void)
|
|||
|
||||
void SocketEvents::Unregister(void)
|
||||
{
|
||||
if (m_FD == INVALID_SOCKET)
|
||||
return;
|
||||
|
||||
{
|
||||
boost::mutex::scoped_lock lock(l_SocketIOMutex);
|
||||
|
||||
l_SocketIOSockets.erase(m_FD);
|
||||
m_FD = INVALID_SOCKET;
|
||||
}
|
||||
|
||||
/* There's no need to wake up the I/O thread here. */
|
||||
WakeUpThread();
|
||||
}
|
||||
|
||||
void SocketEvents::ChangeEvents(int events)
|
||||
{
|
||||
ASSERT(m_FD != INVALID_SOCKET);
|
||||
|
||||
{
|
||||
boost::mutex::scoped_lock lock(l_SocketIOMutex);
|
||||
|
||||
|
|
|
@ -77,6 +77,11 @@ TlsStream::TlsStream(const Socket::Ptr& socket, ConnectionRole role, const boost
|
|||
SSL_set_connect_state(m_SSL.get());
|
||||
}
|
||||
|
||||
TlsStream::~TlsStream(void)
|
||||
{
|
||||
SocketEvents::Unregister();
|
||||
}
|
||||
|
||||
int TlsStream::ValidateCertificate(int preverify_ok, X509_STORE_CTX *ctx)
|
||||
{
|
||||
SSL *ssl = static_cast<SSL *>(X509_STORE_CTX_get_ex_data(ctx, SSL_get_ex_data_X509_STORE_CTX_idx()));
|
||||
|
|
|
@ -50,6 +50,7 @@ public:
|
|||
DECLARE_PTR_TYPEDEFS(TlsStream);
|
||||
|
||||
TlsStream(const Socket::Ptr& socket, ConnectionRole role, const boost::shared_ptr<SSL_CTX>& sslContext);
|
||||
~TlsStream(void);
|
||||
|
||||
boost::shared_ptr<X509> GetClientCertificate(void) const;
|
||||
boost::shared_ptr<X509> GetPeerCertificate(void) const;
|
||||
|
|
Loading…
Reference in New Issue