mirror of https://github.com/Icinga/icinga2.git
parent
49c5c42945
commit
aef5bc2f3a
|
@ -40,7 +40,7 @@ bool I2_EXPORT TlsStream::m_SSLIndexInitialized = false;
|
|||
* @param sslContext The SSL context for the client.
|
||||
*/
|
||||
TlsStream::TlsStream(const Socket::Ptr& socket, ConnectionRole role, const boost::shared_ptr<SSL_CTX>& sslContext)
|
||||
: SocketEvents(socket, this), m_Eof(false), m_HandshakeOK(false), m_VerifyOK(true), m_CloseOK(false), m_ErrorCode(0),
|
||||
: SocketEvents(socket, this), m_Eof(false), m_HandshakeOK(false), m_VerifyOK(true), m_ErrorCode(0),
|
||||
m_ErrorOccurred(false), m_Socket(socket), m_Role(role), m_SendQ(new FIFO()), m_RecvQ(new FIFO()),
|
||||
m_CurrentAction(TlsActionNone), m_Retry(false)
|
||||
{
|
||||
|
@ -125,6 +125,9 @@ void TlsStream::OnEvent(int revents)
|
|||
|
||||
boost::mutex::scoped_lock lock(m_Mutex);
|
||||
|
||||
if (!m_SSL)
|
||||
return;
|
||||
|
||||
char buffer[512];
|
||||
|
||||
if (m_CurrentAction == TlsActionNone) {
|
||||
|
@ -204,7 +207,7 @@ void TlsStream::OnEvent(int revents)
|
|||
|
||||
break;
|
||||
case SSL_ERROR_ZERO_RETURN:
|
||||
Unregister();
|
||||
SocketEvents::Unregister();
|
||||
|
||||
m_SSL.reset();
|
||||
m_Socket->Close();
|
||||
|
@ -215,7 +218,7 @@ void TlsStream::OnEvent(int revents)
|
|||
|
||||
break;
|
||||
default:
|
||||
Unregister();
|
||||
SocketEvents::Unregister();
|
||||
|
||||
m_SSL.reset();
|
||||
m_Socket->Close();
|
||||
|
@ -282,11 +285,16 @@ void TlsStream::Write(const void *buffer, size_t count)
|
|||
void TlsStream::Close(void)
|
||||
{
|
||||
boost::mutex::scoped_lock lock(m_Mutex);
|
||||
|
||||
if (!m_SSL)
|
||||
return;
|
||||
|
||||
(void) SSL_shutdown(m_SSL.get());
|
||||
m_SSL.reset();
|
||||
|
||||
m_Socket->Close();
|
||||
|
||||
m_CloseOK = true;
|
||||
m_CV.notify_all();
|
||||
m_Eof = true;
|
||||
}
|
||||
|
||||
bool TlsStream::IsEof(void) const
|
||||
|
|
|
@ -75,7 +75,6 @@ private:
|
|||
mutable boost::condition_variable m_CV;
|
||||
bool m_HandshakeOK;
|
||||
bool m_VerifyOK;
|
||||
bool m_CloseOK;
|
||||
int m_ErrorCode;
|
||||
bool m_ErrorOccurred;
|
||||
|
||||
|
|
Loading…
Reference in New Issue