diff --git a/components/agent/agentlistener.cpp b/components/agent/agentlistener.cpp index 3d4675afa..469a9b95c 100644 --- a/components/agent/agentlistener.cpp +++ b/components/agent/agentlistener.cpp @@ -137,7 +137,13 @@ void AgentListener::NewClientHandler(const Socket::Ptr& client, TlsRole role) NetworkStream::Ptr netStream = make_shared(client); - TlsStream::Ptr tlsStream = make_shared(netStream, role, m_SSLContext); + TlsStream::Ptr tlsStream; + + { + ObjectLock olock(this); + tlsStream = make_shared(netStream, role, m_SSLContext); + } + tlsStream->Handshake(); shared_ptr cert = tlsStream->GetPeerCertificate();