mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2025-12-17 14:08:03 -06:00
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.
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user