summaryrefslogtreecommitdiffstats
path: root/src/network/socket/qhttpsocketengine.cpp
diff options
context:
space:
mode:
authorAlex Trotsenko <alex1973tr@gmail.com>2015-11-28 15:27:43 +0200
committerAlex Trotsenko <alex1973tr@gmail.com>2016-01-18 11:08:34 +0000
commit294111e25a4e3639a83a87f70ed33ac0b3985f33 (patch)
tree4d71adef84c188917447a028a980f823d89e134a /src/network/socket/qhttpsocketengine.cpp
parent52436965285de2525acd648c6ba5a21d4479c1e4 (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.cpp5
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();
+ }
}
}