Bug 1397686 - The streams that cannot do 0RTT data need to be put in list and added to mReadyForWrite when 0RTT is done. r=hurley

This commit is contained in:
Dragana Damjanovic 2017-09-22 09:09:57 +02:00
Родитель 260dbfe5b2
Коммит 6944131868
2 изменённых файлов: 18 добавлений и 0 удалений

Просмотреть файл

@ -2769,6 +2769,9 @@ Http2Session::ReadSegmentsAgain(nsAHttpSegmentReader *reader,
this, stream, stream->StreamID()));
FlushOutputQueue();
SetWriteCallbacks();
if (!mCannotDo0RTTStreams.Contains(stream)) {
mCannotDo0RTTStreams.AppendElement(stream);
}
// We can still send our preamble
*countRead = mOutputQueueUsed - mOutputQueueSent;
return *countRead ? NS_OK : NS_BASE_STREAM_WOULD_BLOCK;
@ -3393,15 +3396,27 @@ Http2Session::Finish0RTT(bool aRestart, bool aAlpnChanged)
// This is the easy case - early data failed, but we're speaking h2, so
// we just need to rewind to the beginning of the preamble and try again.
mOutputQueueSent = 0;
for (size_t i = 0; i < mCannotDo0RTTStreams.Length(); ++i) {
if (mCannotDo0RTTStreams[i] && VerifyStream(mCannotDo0RTTStreams[i])) {
TransactionHasDataToWrite(mCannotDo0RTTStreams[i]);
}
}
}
} else {
// 0RTT succeeded
for (size_t i = 0; i < mCannotDo0RTTStreams.Length(); ++i) {
if (mCannotDo0RTTStreams[i] && VerifyStream(mCannotDo0RTTStreams[i])) {
TransactionHasDataToWrite(mCannotDo0RTTStreams[i]);
}
}
// Make sure we look for any incoming data in repsonse to our early data.
Unused << ResumeRecv();
}
mAttemptingEarlyData = false;
m0RTTStreams.Clear();
mCannotDo0RTTStreams.Clear();
RealignOutputQueue();
return NS_OK;

Просмотреть файл

@ -529,6 +529,9 @@ private:
bool mAttemptingEarlyData;
// The ID(s) of the stream(s) that we are getting 0RTT data from.
nsTArray<WeakPtr<Http2Stream>> m0RTTStreams;
// The ID(s) of the stream(s) that are not able to send 0RTT data. We need to
// remember them put them into mReadyForWrite queue when 0RTT finishes.
nsTArray<WeakPtr<Http2Stream>> mCannotDo0RTTStreams;
bool RealJoinConnection(const nsACString &hostname, int32_t port, bool jk);
bool TestOriginFrame(const nsACString &name, int32_t port);