From dbfa374a8610948f6e03ea1b3f3bc2905ce05be0 Mon Sep 17 00:00:00 2001 From: Timur Pocheptsov Date: Mon, 2 Sep 2019 10:43:29 +0200 Subject: QHttpNetworkConnectionChannel - avoid re-connecting on 'disconnected' MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The _q_error slot has a special case for RemoteHostClosedError, where the current channel's state is 'idle' and no request/reply is in progress. The comment states that: "Not actually an error, it is normal for Keep-Alive connections to close after some time if no request is sent on them. No need to error the other replies below. Just bail out here. The _q_disconnected will handle the possibly pipelined replies." _q_disconnected, indeed, takes care about pipelined replies ... calling 'ensureConnected' even if we have 0 replies in pipeline, which makes zero sense to me and results in QNAM endlessly trying to re-connect to the server. Fixes: QTBUG-77852 Change-Id: I6dcb43b36a6d432bc940246a08f65e1ee903fd24 Reviewed-by: Volker Hilsheimer Reviewed-by: MÃ¥rten Nordheim Reviewed-by: Timur Pocheptsov --- src/network/access/qhttpnetworkconnectionchannel.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'src/network/access') diff --git a/src/network/access/qhttpnetworkconnectionchannel.cpp b/src/network/access/qhttpnetworkconnectionchannel.cpp index 38adca2633..e7af7b648e 100644 --- a/src/network/access/qhttpnetworkconnectionchannel.cpp +++ b/src/network/access/qhttpnetworkconnectionchannel.cpp @@ -849,8 +849,11 @@ void QHttpNetworkConnectionChannel::_q_disconnected() QMetaObject::invokeMethod(connection, "_q_startNextRequest", Qt::QueuedConnection); } state = QHttpNetworkConnectionChannel::IdleState; - - requeueCurrentlyPipelinedRequests(); + if (alreadyPipelinedRequests.length()) { + // If nothing was in a pipeline, no need in calling + // _q_startNextRequest (which it does): + requeueCurrentlyPipelinedRequests(); + } pendingEncrypt = false; } -- cgit v1.2.3