Fix spdy build without features.properties
Move location of stream ID from a dynamic property to an internal QHash. Change-Id: I9bab4cbfaebe6a04d54afa7889aac748070e1f2e Reviewed-by: Timur Pocheptsov <timur.pocheptsov@qt.io>
This commit is contained in:
parent
dcc4d54fc9
commit
0642444e72
@ -305,7 +305,7 @@ bool QSpdyProtocolHandler::sendRequest()
|
||||
|
||||
currentReply->setSpdyWasUsed(true);
|
||||
qint32 streamID = generateNextStreamID();
|
||||
currentReply->setProperty("SPDYStreamID", streamID);
|
||||
m_streamIDs.insert(currentReply, streamID);
|
||||
|
||||
currentReply->setRequest(currentRequest);
|
||||
currentReply->d_func()->connection = m_connection;
|
||||
@ -322,7 +322,7 @@ bool QSpdyProtocolHandler::sendRequest()
|
||||
|
||||
void QSpdyProtocolHandler::_q_replyDestroyed(QObject* reply)
|
||||
{
|
||||
qint32 streamID = reply->property("SPDYStreamID").toInt();
|
||||
qint32 streamID = m_streamIDs.take(reply);
|
||||
if (m_inFlightStreams.remove(streamID))
|
||||
sendRST_STREAM(streamID, RST_STREAM_CANCEL);
|
||||
}
|
||||
@ -624,10 +624,12 @@ void QSpdyProtocolHandler::sendSYN_STREAM(const HttpMessagePair &messagePair,
|
||||
|
||||
// hack: set the stream ID on the device directly, so when we get
|
||||
// the signal for uploading we know which stream we are sending on
|
||||
request.uploadByteDevice()->setProperty("SPDYStreamID", streamID);
|
||||
m_streamIDs.insert(request.uploadByteDevice(), streamID);
|
||||
|
||||
QObject::connect(request.uploadByteDevice(), SIGNAL(readyRead()), this,
|
||||
SLOT(_q_uploadDataReadyRead()), Qt::QueuedConnection);
|
||||
QObject::connect(request.uploadByteDevice(), SIGNAL(destroyed(QObject*)), this,
|
||||
SLOT(_q_uploadDataDestroyed(QObject *)));
|
||||
}
|
||||
|
||||
QByteArray namesAndValues = composeHeader(request);
|
||||
@ -663,6 +665,11 @@ void QSpdyProtocolHandler::sendSYN_STREAM(const HttpMessagePair &messagePair,
|
||||
uploadData(streamID);
|
||||
}
|
||||
|
||||
void QSpdyProtocolHandler::_q_uploadDataDestroyed(QObject *uploadData)
|
||||
{
|
||||
m_streamIDs.remove(uploadData);
|
||||
}
|
||||
|
||||
void QSpdyProtocolHandler::sendRST_STREAM(qint32 streamID, RST_STREAM_STATUS_CODE statusCode)
|
||||
{
|
||||
char wireData[8];
|
||||
@ -756,7 +763,7 @@ void QSpdyProtocolHandler::_q_uploadDataReadyRead()
|
||||
{
|
||||
QNonContiguousByteDevice *device = qobject_cast<QNonContiguousByteDevice *>(sender());
|
||||
Q_ASSERT(device);
|
||||
qint32 streamID = device->property("SPDYStreamID").toInt();
|
||||
qint32 streamID = m_streamIDs.value(device);
|
||||
Q_ASSERT(streamID > 0);
|
||||
uploadData(streamID);
|
||||
}
|
||||
|
@ -110,6 +110,7 @@ public:
|
||||
private slots:
|
||||
void _q_uploadDataReadyRead();
|
||||
void _q_replyDestroyed(QObject*);
|
||||
void _q_uploadDataDestroyed(QObject *);
|
||||
|
||||
private:
|
||||
|
||||
@ -216,6 +217,7 @@ private:
|
||||
bool m_waitingForCompleteStream;
|
||||
z_stream m_deflateStream;
|
||||
z_stream m_inflateStream;
|
||||
QHash<QObject *, qint32> m_streamIDs;
|
||||
};
|
||||
|
||||
Q_DECLARE_OPERATORS_FOR_FLAGS(QSpdyProtocolHandler::DataFrameFlags)
|
||||
|
Loading…
Reference in New Issue
Block a user