bug 1211706 - fix network io loop spin when clearing h2 flow control buffer r=hurley
authorPatrick McManus <mcmanus@ducksong.com>
Wed, 07 Oct 2015 17:45:46 -0400
changeset 266987 b8b6944505bcdf215561bf9296a08ff5da4a29df
parent 266986 39ccbc9935c23400d960223012dbcf846008a810
child 266988 0b1fbd9ec5498a47ef31dca8ba952d0e048ff7b8
push id29504
push usercbook@mozilla.com
push dateFri, 09 Oct 2015 09:43:23 +0000
treeherdermozilla-central@d01dd42e654b [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewershurley
bugs1211706
milestone44.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
bug 1211706 - fix network io loop spin when clearing h2 flow control buffer r=hurley
netwerk/protocol/http/Http2Session.cpp
--- a/netwerk/protocol/http/Http2Session.cpp
+++ b/netwerk/protocol/http/Http2Session.cpp
@@ -2881,17 +2881,20 @@ Http2Session::ProcessSlowConsumer(Http2S
   nsresult rv = slowConsumer->WriteSegments(this, count, countWritten);
   mSegmentWriter = nullptr;
   LOG3(("Http2Session::ProcessSlowConsumer Writesegments %p 0x%X rv %X %d\n",
         this, slowConsumer->StreamID(), rv, *countWritten));
   if (NS_SUCCEEDED(rv) && !*countWritten && slowConsumer->RecvdFin()) {
     rv = NS_BASE_STREAM_CLOSED;
   }
 
-  if (NS_SUCCEEDED(rv)) {
+  if (NS_SUCCEEDED(rv) && (*countWritten > 0)) {
+    // There have been buffered bytes successfully fed into the
+    // formerly blocked consumer. Repeat until buffer empty or
+    // consumer is blocked again.
     UpdateLocalRwin(slowConsumer, 0);
     ConnectSlowConsumer(slowConsumer);
   }
 
   if (rv == NS_BASE_STREAM_CLOSED) {
     CleanupStream(slowConsumer, NS_OK, CANCEL_ERROR);
     rv = NS_OK;
   }