mirror of
https://github.com/qbittorrent/qBittorrent
synced 2025-07-16 02:03:07 -07: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
1 changed files with 3 additions and 1 deletions
|
@ -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…
Add table
Add a link
Reference in a new issue