1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 13:38:11 +00:00

LibTLS: Only try to flush data when needed

This patchset drops the write notifier, and schedules writes only when
necessary.
As a result, the CPU utilisation no longer spikes to the skies :^)
This commit is contained in:
AnotherTest 2020-05-19 19:03:57 +04:30 committed by Andreas Kling
parent 41da1a4336
commit 379cb061d7
3 changed files with 64 additions and 56 deletions

View file

@ -34,6 +34,12 @@ namespace TLS {
void TLSv12::write_packet(ByteBuffer& packet)
{
m_context.tls_buffer.append(packet.data(), packet.size());
if (!m_has_scheduled_write_flush && m_context.connection_status > ConnectionStatus::Disconnected) {
#ifdef TLS_DEBUG
dbg() << "Scheduling write of " << m_context.tls_buffer.size();
#endif
deferred_invoke([this](auto&) { write_into_socket(); });
}
}
void TLSv12::update_packet(ByteBuffer& packet)