Bug 1228822 - Ensure we send out the window update when matching a pushed stream with a pull stream. r=mcmanus

--HG--
extra : commitid : D6pRH1pTQe6
extra : rebase_source : 0b1d5f10a9ebeda7b037e2c147f426908ef241a2
This commit is contained in:
Nicholas Hurley 2015-12-09 10:11:04 -08:00
Родитель b95ff06630
Коммит a6d6d5ef55
4 изменённых файлов: 33 добавлений и 3 удалений

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

@ -173,6 +173,22 @@ Http2PushedStream::ReadSegments(nsAHttpSegmentReader *,
return NS_OK;
}
void
Http2PushedStream::AdjustInitialWindow()
{
LOG3(("Http2PushStream %p 0x%X AdjustInitialWindow", this, mStreamID));
if (mConsumerStream) {
LOG3(("Http2PushStream::AdjustInitialWindow %p 0x%X calling super %p", this,
mStreamID, mConsumerStream));
Http2Stream::AdjustInitialWindow();
// We have to use mConsumerStream here because our ReadSegments is a nop for
// actually sending data.
mSession->TransactionHasDataToWrite(mConsumerStream);
}
// Otherwise, when we get hooked up, the initial window will get bumped
// anyway, so we're good to go.
}
void
Http2PushedStream::SetConsumerStream(Http2Stream *consumer)
{

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

@ -46,6 +46,7 @@ public:
// override of Http2Stream
nsresult ReadSegments(nsAHttpSegmentReader *, uint32_t, uint32_t *) override;
nsresult WriteSegments(nsAHttpSegmentWriter *, uint32_t, uint32_t *) override;
void AdjustInitialWindow() override;
nsISchedulingContext *SchedulingContext() override { return mSchedulingContext; };
void ConnectPushedStream(Http2Stream *consumer);

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

@ -67,6 +67,7 @@ Http2Stream::Http2Stream(nsAHttpTransaction *httpTransaction,
, mRequestBodyLenRemaining(0)
, mLocalUnacked(0)
, mBlockedOnRwin(false)
, mSentPushWindowBump(false)
, mTotalSent(0)
, mTotalRead(0)
, mPushSource(nullptr)
@ -478,8 +479,8 @@ Http2Stream::ParseHttpRequestHeaders(const char *buf,
mSession, hashkey.get(), schedulingContext, cache, pushedStream));
if (pushedStream) {
LOG3(("Pushed Stream Match located id=0x%X key=%s\n",
pushedStream->StreamID(), hashkey.get()));
LOG3(("Pushed Stream Match located %p id=0x%X key=%s\n",
pushedStream, pushedStream->StreamID(), hashkey.get()));
pushedStream->SetConsumerStream(this);
mPushSource = pushedStream;
SetSentFin(true);
@ -1386,6 +1387,14 @@ Http2Stream::OnReadSegment(const char *buf,
MOZ_ASSERT(false, "resuming partial fin stream out of OnReadSegment");
break;
case UPSTREAM_COMPLETE:
MOZ_ASSERT(mPushSource && !mSentPushWindowBump, "unexpected upstream_complete");
rv = TransmitFrame(nullptr, nullptr, true);
if (NS_SUCCEEDED(rv)) {
mSentPushWindowBump = true;
}
break;
default:
MOZ_ASSERT(false, "Http2Stream::OnReadSegment non-write state");
break;

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

@ -200,6 +200,8 @@ protected:
void ChangeState(enum upstreamStateType);
virtual void AdjustInitialWindow();
private:
friend class nsAutoPtr<Http2Stream>;
@ -207,7 +209,6 @@ private:
nsresult GenerateOpen();
void AdjustPushedPriority();
void AdjustInitialWindow();
nsresult TransmitFrame(const char *, uint32_t *, bool forceCommitment);
void GenerateDataFrameHeader(uint32_t, bool);
@ -312,6 +313,9 @@ private:
// <= 0
bool mBlockedOnRwin;
// For properly adjusting push stream windows - see bug 1228822
bool mSentPushWindowBump;
// For Progress Events
uint64_t mTotalSent;
uint64_t mTotalRead;