Bug 1349246 - fix stream target for early transport status events. r?mcmanus
MozReview-Commit-ID: 9IGDNbNH0L8
--- a/netwerk/protocol/http/Http2Session.cpp
+++ b/netwerk/protocol/http/Http2Session.cpp
@@ -953,16 +953,19 @@ Http2Session::SendHello()
CreatePriorityNode(kBackgroundGroupID, 0, 0, "background");
mNextStreamID += 2;
MOZ_ASSERT(mNextStreamID == kSpeculativeGroupID);
CreatePriorityNode(kSpeculativeGroupID, kBackgroundGroupID, 0, "speculative");
mNextStreamID += 2;
MOZ_ASSERT(mNextStreamID == kFollowerGroupID);
CreatePriorityNode(kFollowerGroupID, kLeaderGroupID, 0, "follower");
mNextStreamID += 2;
+ // Hey, you! YES YOU! If you add/remove any groups here, you almost
+ // certainly need to change the lookup of the stream/ID hash in
+ // Http2Session::OnTransportStatus. Yeah, that's right. YOU!
}
FlushOutputQueue();
}
void
Http2Session::CreatePriorityNode(uint32_t streamID, uint32_t dependsOn, uint8_t weight,
const char *label)
@@ -2302,17 +2305,17 @@ Http2Session::OnTransportStatus(nsITrans
switch (aStatus) {
// These should appear only once, deliver to the first
// transaction on the session.
case NS_NET_STATUS_RESOLVING_HOST:
case NS_NET_STATUS_RESOLVED_HOST:
case NS_NET_STATUS_CONNECTING_TO:
case NS_NET_STATUS_CONNECTED_TO:
{
- Http2Stream *target = mStreamIDHash.Get(1);
+ Http2Stream *target = mStreamIDHash.Get(mUseH2Deps ? 0xD : 0x3);
nsAHttpTransaction *transaction = target ? target->Transaction() : nullptr;
if (transaction)
transaction->OnTransportStatus(aTransport, aStatus, aProgress);
break;
}
default:
// The other transport events are ignored here because there is no good
--- a/netwerk/protocol/http/Http2Session.h
+++ b/netwerk/protocol/http/Http2Session.h
@@ -165,16 +165,19 @@ public:
kFrameTypeBytes + kFrameStreamIDBytes;
enum {
kLeaderGroupID = 0x3,
kOtherGroupID = 0x5,
kBackgroundGroupID = 0x7,
kSpeculativeGroupID = 0x9,
kFollowerGroupID = 0xB
+ // Hey, you! YES YOU! If you add/remove any groups here, you almost
+ // certainly need to change the lookup of the stream/ID hash in
+ // Http2Session::OnTransportStatus. Yeah, that's right. YOU!
};
static nsresult RecvHeaders(Http2Session *);
static nsresult RecvPriority(Http2Session *);
static nsresult RecvRstStream(Http2Session *);
static nsresult RecvSettings(Http2Session *);
static nsresult RecvPushPromise(Http2Session *);
static nsresult RecvPing(Http2Session *);