Bug 1349246 - fix stream target for early transport status events. r?mcmanus draft
authorNicholas Hurley <hurley@mozilla.com>
Thu, 16 Mar 2017 08:45:42 -0700
changeset 502464 eea78525b903a2b452da816da173495e60b8675e
parent 500108 3945f2297b997d59662bdb8ac20e092363eea532
child 550160 ed4f6698512164454fe15e659fae46fadd3d95c0
push id50282
push userbmo:hurley@mozilla.com
push dateTue, 21 Mar 2017 20:04:49 +0000
reviewersmcmanus
bugs1349246
milestone55.0a1
Bug 1349246 - fix stream target for early transport status events. r?mcmanus MozReview-Commit-ID: 9IGDNbNH0L8
netwerk/protocol/http/Http2Session.cpp
netwerk/protocol/http/Http2Session.h
--- 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 *);