Browse Source

Don't expire connection when there are data in buffer

For writing, this ensures expire handler won't be executed in a small
time window, that is after `m_socket->write()` and before
`QIODevice::bytesWritten()` signal.
For reading, this let the socket to have the chance to process the
received data instead of dropping it.

PR #15849.
adaptive-webui-19844
Chocobo1 3 years ago committed by GitHub
parent
commit
aedd997604
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 4
      src/base/http/connection.cpp

4
src/base/http/connection.cpp

@ -134,7 +134,9 @@ void Connection::sendResponse(const Response &response) const @@ -134,7 +134,9 @@ void Connection::sendResponse(const Response &response) const
bool Connection::hasExpired(const qint64 timeout) const
{
return m_idleTimer.hasExpired(timeout);
return (m_socket->bytesAvailable() == 0)
&& (m_socket->bytesToWrite() == 0)
&& m_idleTimer.hasExpired(timeout);
}
bool Connection::isClosed() const

Loading…
Cancel
Save