void cTCPLinkImpl::cLinkTlsContext::Send(const void * a_Data, size_t a_Length) { // Hold self alive for the duration of this function cLinkTlsContextPtr Self(m_Self); // If the handshake hasn't completed yet, queue the data: if (!HasHandshaken()) { m_CleartextData.append(reinterpret_cast<const char *>(a_Data), a_Length); TryFinishHandshaking(); return; } // The connection is all set up, write the cleartext data into the SSL context: WritePlain(a_Data, a_Length); FlushBuffers(); }
void cLuaTCPLink::cLinkSslContext::Send(const AString & a_Data) { // Hold self alive for the duration of this function cLinkSslContextPtr Self(m_Self); // If the handshake hasn't completed yet, queue the data: if (!HasHandshaken()) { m_CleartextData.append(a_Data); TryFinishHandshaking(); return; } // The connection is all set up, write the cleartext data into the SSL context: WritePlain(a_Data.data(), a_Data.size()); FlushBuffers(); }
void cTCPLinkImpl::cLinkTlsContext::TryFinishHandshaking(void) { // Hold self alive for the duration of this function cLinkTlsContextPtr Self(m_Self); // If the handshake hasn't finished yet, retry: if (!HasHandshaken()) { Handshake(); // If the handshake succeeded, write all the queued plaintext data: if (HasHandshaken()) { m_Link.GetCallbacks()->OnTlsHandshakeCompleted(); WritePlain(m_CleartextData.data(), m_CleartextData.size()); m_CleartextData.clear(); } } }
void cLuaTCPLink::cLinkSslContext::TryFinishHandshaking(void) { // Hold self alive for the duration of this function cLinkSslContextPtr Self(m_Self); // If the handshake hasn't finished yet, retry: if (!HasHandshaken()) { Handshake(); } // If the handshake succeeded, write all the queued plaintext data: if (HasHandshaken()) { WritePlain(m_CleartextData.data(), m_CleartextData.size()); m_CleartextData.clear(); } }