bug 955161 - spdy session sometimes shutdown when gecko cancels a sub transaction r=hurley

This commit is contained in:
Patrick McManus 2014-01-07 07:29:11 -05:00
parent 62bd00021f
commit 1c1b50185e
3 changed files with 17 additions and 8 deletions

View File

@ -44,6 +44,13 @@ public:
// reason to throttle with the rwin other than in server push
// scenarios.
const static uint32_t kInitialRwin = 256 * 1024 * 1024;
bool SoftStreamError(nsresult code)
{
return (code == NS_BASE_STREAM_CLOSED || code == NS_BINDING_FAILED ||
code == NS_BINDING_ABORTED || code == NS_BINDING_REDIRECTED ||
code == NS_BINDING_RETARGETED);
}
};
// this is essentially a single instantiation as a member of nsHttpHandler.

View File

@ -2016,9 +2016,10 @@ SpdySession3::WriteSegments(nsAHttpSegmentWriter *writer,
mLastDataReadEpoch = mLastReadEpoch;
if (rv == NS_BASE_STREAM_CLOSED) {
if (SoftStreamError(rv)) {
// This will happen when the transaction figures out it is EOF, generally
// due to a content-length match being made
// due to a content-length match being made. Return OK from this function
// otherwise the whole session would be torn down.
SpdyStream3 *stream = mInputFrameDataStream;
// if we were doing PROCESSING_COMPLETE_HEADERS need to pop the state
@ -2029,9 +2030,9 @@ SpdySession3::WriteSegments(nsAHttpSegmentWriter *writer,
ResetDownstreamState();
LOG3(("SpdySession3::WriteSegments session=%p stream=%p 0x%X "
"needscleanup=%p. cleanup stream based on "
"stream->writeSegments returning BASE_STREAM_CLOSED\n",
"stream->writeSegments returning code %X\n",
this, stream, stream ? stream->StreamID() : 0,
mNeedsCleanup));
mNeedsCleanup, rv));
CleanupStream(stream, NS_OK, RST_CANCEL);
MOZ_ASSERT(!mNeedsCleanup, "double cleanup out of data frame");
mNeedsCleanup = nullptr; /* just in case */

View File

@ -2085,9 +2085,10 @@ SpdySession31::WriteSegments(nsAHttpSegmentWriter *writer,
mLastDataReadEpoch = mLastReadEpoch;
if (rv == NS_BASE_STREAM_CLOSED) {
if (SoftStreamError(rv)) {
// This will happen when the transaction figures out it is EOF, generally
// due to a content-length match being made
// due to a content-length match being made. Return OK from this function
// otherwise the whole session would be torn down.
SpdyStream31 *stream = mInputFrameDataStream;
// if we were doing PROCESSING_COMPLETE_HEADERS need to pop the state
@ -2098,9 +2099,9 @@ SpdySession31::WriteSegments(nsAHttpSegmentWriter *writer,
ResetDownstreamState();
LOG3(("SpdySession31::WriteSegments session=%p stream=%p 0x%X "
"needscleanup=%p. cleanup stream based on "
"stream->writeSegments returning BASE_STREAM_CLOSED\n",
"stream->writeSegments returning code %X\n",
this, stream, stream ? stream->StreamID() : 0,
mNeedsCleanup));
mNeedsCleanup, rv));
CleanupStream(stream, NS_OK, RST_CANCEL);
MOZ_ASSERT(!mNeedsCleanup, "double cleanup out of data frame");
mNeedsCleanup = nullptr; /* just in case */