summaryrefslogtreecommitdiffstats
path: root/src/network/access/qspdyprotocolhandler.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/network/access/qspdyprotocolhandler.cpp')
-rw-r--r--src/network/access/qspdyprotocolhandler.cpp41
1 files changed, 18 insertions, 23 deletions
diff --git a/src/network/access/qspdyprotocolhandler.cpp b/src/network/access/qspdyprotocolhandler.cpp
index 7430ca029d..5f9697ab92 100644
--- a/src/network/access/qspdyprotocolhandler.cpp
+++ b/src/network/access/qspdyprotocolhandler.cpp
@@ -288,16 +288,14 @@ bool QSpdyProtocolHandler::sendRequest()
m_channel->state = QHttpNetworkConnectionChannel::WritingState;
- // requests will be ordered by priority (see QMultiMap doc)
- QList<HttpMessagePair> requests = m_channel->spdyRequestsToSend.values();
- QList<int> priorities = m_channel->spdyRequestsToSend.keys();
-
- int requestsToSend = qMin(requests.count(), maxPossibleRequests);
+ int requestsToSend = qMin(m_channel->spdyRequestsToSend.size(), maxPossibleRequests);
+ QMultiMap<int, HttpMessagePair>::iterator it = m_channel->spdyRequestsToSend.begin();
+ // requests will be ordered by priority (see QMultiMap doc)
for (int a = 0; a < requestsToSend; ++a) {
- HttpMessagePair currentPair = requests.at(a);
- QHttpNetworkRequest currentRequest = requests.at(a).first;
- QHttpNetworkReply *currentReply = requests.at(a).second;
+ HttpMessagePair currentPair = *it;
+ QHttpNetworkRequest currentRequest = currentPair.first;
+ QHttpNetworkReply *currentReply = currentPair.second;
currentReply->setSpdyWasUsed(true);
qint32 streamID = generateNextStreamID();
@@ -310,10 +308,7 @@ bool QSpdyProtocolHandler::sendRequest()
connect(currentReply, SIGNAL(destroyed(QObject*)), this, SLOT(_q_replyDestroyed(QObject*)));
sendSYN_STREAM(currentPair, streamID, /* associatedToStreamID = */ 0);
- int requestsRemoved = m_channel->spdyRequestsToSend.remove(
- priorities.at(a), currentPair);
- Q_ASSERT(requestsRemoved == 1);
- Q_UNUSED(requestsRemoved); // silence -Wunused-variable
+ m_channel->spdyRequestsToSend.erase(it++);
}
m_channel->state = QHttpNetworkConnectionChannel::IdleState;
return true;
@@ -457,7 +452,7 @@ bool QSpdyProtocolHandler::uncompressHeader(const QByteArray &input, QByteArray
break;
}
default: {
- qWarning() << Q_FUNC_INFO << "got unexpected zlib return value:" << zlibRet;
+ qWarning() << "got unexpected zlib return value:" << zlibRet;
return false;
}
}
@@ -693,7 +688,7 @@ bool QSpdyProtocolHandler::uploadData(qint32 streamID)
Q_ASSERT(replyPrivate);
if (reply->d_func()->state == QHttpNetworkReplyPrivate::SPDYHalfClosed || reply->d_func()->state == QHttpNetworkReplyPrivate::SPDYClosed) {
- qWarning() << Q_FUNC_INFO << "Trying to upload to closed stream";
+ qWarning("Trying to upload to closed stream");
return false;
}
@@ -848,7 +843,7 @@ void QSpdyProtocolHandler::handleControlFrame(const QByteArray &frameHeaders) //
break;
}
default:
- qWarning() << Q_FUNC_INFO << "cannot handle frame of type" << type;
+ qWarning() << "cannot handle frame of type" << type;
}
}
@@ -892,13 +887,13 @@ void QSpdyProtocolHandler::parseHttpHeaders(char flags, const QByteArray &frameD
QByteArray uncompressedHeader;
if (!uncompressHeader(headerValuePairs, &uncompressedHeader)) {
- qWarning() << Q_FUNC_INFO << "error reading header from SYN_REPLY message";
+ qWarning("error reading header from SYN_REPLY message");
return;
}
qint32 headerCount = fourBytesToInt(uncompressedHeader.constData());
if (headerCount * 8 > uncompressedHeader.size()) {
- qWarning() << Q_FUNC_INFO << "error parsing header from SYN_REPLY message";
+ qWarning("error parsing header from SYN_REPLY message");
sendRST_STREAM(streamID, RST_STREAM_PROTOCOL_ERROR);
return;
}
@@ -909,7 +904,7 @@ void QSpdyProtocolHandler::parseHttpHeaders(char flags, const QByteArray &frameD
QByteArray name = uncompressedHeader.mid(readPointer, count);
readPointer += count;
if (readPointer > uncompressedHeader.size()) {
- qWarning() << Q_FUNC_INFO << "error parsing header from SYN_REPLY message";
+ qWarning("error parsing header from SYN_REPLY message");
sendRST_STREAM(streamID, RST_STREAM_PROTOCOL_ERROR);
return;
}
@@ -918,7 +913,7 @@ void QSpdyProtocolHandler::parseHttpHeaders(char flags, const QByteArray &frameD
QByteArray value = uncompressedHeader.mid(readPointer, count);
readPointer += count;
if (readPointer > uncompressedHeader.size()) {
- qWarning() << Q_FUNC_INFO << "error parsing header from SYN_REPLY message";
+ qWarning("error parsing header from SYN_REPLY message");
sendRST_STREAM(streamID, RST_STREAM_PROTOCOL_ERROR);
return;
}
@@ -1019,7 +1014,7 @@ void QSpdyProtocolHandler::handleRST_STREAM(char /*flags*/, quint32 length,
errorMessage = "server cannot process the frame because it is too large";
break;
default:
- qWarning() << Q_FUNC_INFO << "could not understand servers RST_STREAM status code";
+ qWarning("could not understand servers RST_STREAM status code");
errorCode = QNetworkReply::ProtocolFailure;
errorMessage = "got SPDY RST_STREAM message with unknown error code";
}
@@ -1083,7 +1078,7 @@ void QSpdyProtocolHandler::handleSETTINGS(char flags, quint32 /*length*/, const
break;
}
default:
- qWarning() << Q_FUNC_INFO << "found unknown settings value" << value;
+ qWarning() << "found unknown settings value" << value;
}
}
}
@@ -1122,7 +1117,7 @@ void QSpdyProtocolHandler::handleGOAWAY(char /*flags*/, quint32 /*length*/,
break;
}
default:
- qWarning() << Q_FUNC_INFO << "unexpected status code" << statusCode;
+ qWarning() << "unexpected status code" << statusCode;
errorCode = QNetworkReply::ProtocolUnknownError;
}
@@ -1257,7 +1252,7 @@ void QSpdyProtocolHandler::handleDataFrame(const QByteArray &frameHeaders)
}
if (flag_compress) {
- qWarning() << Q_FUNC_INFO << "SPDY level compression is not supported";
+ qWarning("SPDY level compression is not supported");
}
if (flag_fin) {