Fix race condition in AgentListener::NewClientHandler.

Refs #4865
This commit is contained in:
Gunnar Beutner 2014-04-12 13:09:25 +02:00
parent cca79a3849
commit 71e6eae23f
1 changed files with 7 additions and 1 deletions

View File

@ -137,7 +137,13 @@ void AgentListener::NewClientHandler(const Socket::Ptr& client, TlsRole role)
NetworkStream::Ptr netStream = make_shared<NetworkStream>(client); NetworkStream::Ptr netStream = make_shared<NetworkStream>(client);
TlsStream::Ptr tlsStream = make_shared<TlsStream>(netStream, role, m_SSLContext); TlsStream::Ptr tlsStream;
{
ObjectLock olock(this);
tlsStream = make_shared<TlsStream>(netStream, role, m_SSLContext);
}
tlsStream->Handshake(); tlsStream->Handshake();
shared_ptr<X509> cert = tlsStream->GetPeerCertificate(); shared_ptr<X509> cert = tlsStream->GetPeerCertificate();