mirror of
https://github.com/d47081/qBittorrent.git
synced 2025-03-11 12:51:03 +00: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:
parent
aa3da942cb
commit
aedd997604
@ -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…
x
Reference in New Issue
Block a user