From 294111e25a4e3639a83a87f70ed33ac0b3985f33 Mon Sep 17 00:00:00 2001 From: Alex Trotsenko Date: Sat, 28 Nov 2015 15:27:43 +0200 Subject: 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 --- src/network/socket/qhttpsocketengine.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/network') 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(); + } } } -- cgit v1.2.3