1
0
Fork 0

Merge pull request #2897 from cuberite/FlushLuaSsl

LuaTCPLink: Report data received via SSL just before connection closed.
This commit is contained in:
Mattes D 2016-02-21 12:25:43 +01:00
commit 81e80f6edb
1 changed files with 10 additions and 2 deletions

View File

@ -416,9 +416,10 @@ void cLuaTCPLink::OnReceivedData(const char * a_Data, size_t a_Length)
}
// If we're running in SSL mode, put the data into the SSL decryptor:
if (m_SslContext != nullptr)
auto sslContext = m_SslContext;
if (sslContext != nullptr)
{
m_SslContext->StoreReceivedData(a_Data, a_Length);
sslContext->StoreReceivedData(a_Data, a_Length);
return;
}
@ -442,6 +443,13 @@ void cLuaTCPLink::OnRemoteClosed(void)
return;
}
// If running in SSL mode and there's data left in the SSL contect, report it:
auto sslContext = m_SslContext;
if (sslContext != nullptr)
{
sslContext->FlushBuffers();
}
// Call the callback:
cPluginLua::cOperation Op(m_Plugin);
if (!Op().Call(cLuaState::cTableRef(m_Callbacks, "OnRemoteClosed"), this))