QNAM: fix stall due to edge case when connected with no request queued
It really could only manifest itself if you started a request and then immediately cancelled it and then started another one to the same site. But only if in a certain race outcome - the connection that the backend was establishing had to finish connecting after aborting but before a new request had been queued! Change-Id: I7cad2cf4ac1f64cc838498cefa076cd2c6d26701 Reviewed-by: Alex Blasche <alexander.blasche@qt.io> Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>bb10
parent
bbec7aaf3a
commit
9440d602e5
|
|
@ -1066,8 +1066,18 @@ void QHttpNetworkConnectionPrivate::_q_startNextRequest()
|
|||
channels[0].networkLayerPreference = QAbstractSocket::IPv6Protocol;
|
||||
channels[0].ensureConnection();
|
||||
if (channels[0].socket && channels[0].socket->state() == QAbstractSocket::ConnectedState
|
||||
&& !channels[0].pendingEncrypt && channels[0].h2RequestsToSend.size())
|
||||
channels[0].sendRequest();
|
||||
&& !channels[0].pendingEncrypt) {
|
||||
if (channels[0].h2RequestsToSend.size()) {
|
||||
channels[0].sendRequest();
|
||||
} else if (!channels[0].reply && !channels[0].switchedToHttp2) {
|
||||
// This covers an edge-case where we're already connected and the "connected"
|
||||
// signal was already sent, but we didn't have any request available at the time,
|
||||
// so it was missed. As such we need to dequeue a request and send it now that we
|
||||
// have one.
|
||||
dequeueRequest(channels[0].socket);
|
||||
channels[0].sendRequest();
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue