wsd: perform socket writes more efficiently

Since it's most efficent to send full blocks at
once (especially so when SSL encryption is done),
we now perform write when the buffer has fewer
than the send-buffer-size bytes. Previously,
we were only getting more data to write to the
socket when the buffer was completely empty,
potentially wasting valuable opportunity to
write more data to the socket while we're at it.

Change-Id: I69a18a042dc2e551ebc5e1af40dae091da3f3d13
Signed-off-by: Ashod Nakashian <ashod.nakashian@collabora.co.uk>
This commit is contained in:
Ashod Nakashian 2021-02-28 14:03:23 -05:00 committed by Ashod Nakashian
parent 4e9ffdf6d5
commit 26be3a2a2f

View file

@ -1226,7 +1226,7 @@ protected:
do
{
// If we have space for writing and that was requested
if ((events & POLLOUT) && _outBuffer.empty())
if ((events & POLLOUT) && (static_cast<int>(_outBuffer.size()) < getSendBufferSize()))
_socketHandler->performWrites();
// perform the shutdown if we have sent everything.