diff options
author | Alex Trotsenko <alex1973tr@gmail.com> | 2015-11-28 15:27:43 +0200 |
---|---|---|
committer | Alex Trotsenko <alex1973tr@gmail.com> | 2016-01-18 11:08:34 +0000 |
commit | 294111e25a4e3639a83a87f70ed33ac0b3985f33 (patch) | |
tree | 4d71adef84c188917447a028a980f823d89e134a /src/network/socket/qhttpsocketengine.cpp | |
parent | 52436965285de2525acd648c6ba5a21d4479c1e4 (diff) |
QHttpSocketEngine: ensure pending EOF triggers a notification
When the remote peer closed the connection, a read notification needs
to always be emitted, otherwise the higher layer does not get the
disconnected signal. From the other side, underlying QAbstractSocket
object could temporarily disable notifications from the engine at
any time. To avoid possible blocking of the socket, take a pending EOF
into account when the read notifications are re-enabled.
Change-Id: Iac9d4e2f790530be3500baf5a2000f1f63df5cc2
Reviewed-by: Ulf Hermann <ulf.hermann@theqtcompany.com>
Diffstat (limited to 'src/network/socket/qhttpsocketengine.cpp')
-rw-r--r-- | src/network/socket/qhttpsocketengine.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/network/socket/qhttpsocketengine.cpp b/src/network/socket/qhttpsocketengine.cpp index 92ca76b560..a744688f29 100644 --- a/src/network/socket/qhttpsocketengine.cpp +++ b/src/network/socket/qhttpsocketengine.cpp @@ -439,8 +439,11 @@ void QHttpSocketEngine::setReadNotificationEnabled(bool enable) d->readNotificationEnabled = enable; if (enable) { // Enabling read notification can trigger a notification. - if (bytesAvailable()) + if (bytesAvailable()) { slotSocketReadNotification(); + } else if (d->socket && d->socket->state() == QAbstractSocket::UnconnectedState) { + emitReadNotification(); + } } } |