bug 756551 part 2 verify state of spdy mNeedsCleanup stream r=honzab
authorPatrick McManus <mcmanus@ducksong.com>
Mon, 21 May 2012 17:09:34 -0400
changeset 98536 64187d60fae77b1dc3e373666b9068882d11a5a5
parent 98535 1157a225434af657c59bcc5f11e8e01bedd1224d
child 98591 be1d39277fbeb141e41f8d8b6bd53f095cda0ae4
push id1116
push userlsblakk@mozilla.com
push dateMon, 16 Jul 2012 19:38:18 +0000
treeherdermozilla-beta@95f959a8b4dc [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewershonzab
bugs756551
milestone15.0a1
first release with
nightly linux32
64187d60fae7 / 15.0a1 / 20120522030529 / files
nightly linux64
64187d60fae7 / 15.0a1 / 20120522030529 / files
nightly mac
64187d60fae7 / 15.0a1 / 20120522030529 / files
nightly win32
64187d60fae7 / 15.0a1 / 20120522030529 / files
nightly win64
64187d60fae7 / 15.0a1 / 20120522030529 / files
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
releases
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
bug 756551 part 2 verify state of spdy mNeedsCleanup stream r=honzab
netwerk/protocol/http/SpdySession.cpp
--- a/netwerk/protocol/http/SpdySession.cpp
+++ b/netwerk/protocol/http/SpdySession.cpp
@@ -1703,16 +1703,21 @@ SpdySession::WriteSegments(nsAHttpSegmen
           stream ? stream->StreamID() : 0));
     CleanupStream(stream, rv, RST_CANCEL);
     return NS_OK;
   }
 
   if (mDownstreamState == PROCESSING_DATA_FRAME ||
       mDownstreamState == PROCESSING_CONTROL_SYN_REPLY) {
 
+    // The cleanup stream should only be set while stream->WriteSegments is
+    // on the stack and then cleaned up in this code block afterwards.
+    NS_ABORT_IF_FALSE(!mNeedsCleanup, "cleanup stream set unexpectedly");
+    mNeedsCleanup = nsnull;                     /* just in case */
+
     mSegmentWriter = writer;
     rv = mInputFrameDataStream->WriteSegments(this, count, countWritten);
     mSegmentWriter = nsnull;
 
     mLastDataReadEpoch = mLastReadEpoch;
 
     if (rv == NS_BASE_STREAM_CLOSED) {
       // This will happen when the transaction figures out it is EOF, generally
@@ -1722,16 +1727,17 @@ SpdySession::WriteSegments(nsAHttpSegmen
         ResetDownstreamState();
       LOG3(("SpdySession::WriteSegments session=%p stream=%p 0x%X "
             "needscleanup=%p. cleanup stream based on "
             "stream->writeSegments returning BASE_STREAM_CLOSED\n",
             this, stream, stream ? stream->StreamID() : 0,
             mNeedsCleanup));
       CleanupStream(stream, NS_OK, RST_CANCEL);
       NS_ABORT_IF_FALSE(!mNeedsCleanup, "double cleanup out of data frame");
+      mNeedsCleanup = nsnull;                     /* just in case */
       return NS_OK;
     }
     
     if (mNeedsCleanup) {
       LOG3(("SpdySession::WriteSegments session=%p stream=%p 0x%X "
             "cleanup stream based on mNeedsCleanup.\n",
             this, mNeedsCleanup, mNeedsCleanup ? mNeedsCleanup->StreamID() : 0));
       CleanupStream(mNeedsCleanup, NS_OK, RST_CANCEL);