summaryrefslogtreecommitdiffstats
path: root/net/spdy
diff options
context:
space:
mode:
authorerikchen@google.com <erikchen@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2010-08-10 00:04:18 +0000
committererikchen@google.com <erikchen@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2010-08-10 00:04:18 +0000
commitc9336d2894620ea2fb48fd658dc1d26ef6b30ed1 (patch)
tree7818e367ecb5c31726ae1701bb61901ae108b1ce /net/spdy
parent13ad1c76c511fba1901c077886665b175c9de5f2 (diff)
downloadchromium_src-c9336d2894620ea2fb48fd658dc1d26ef6b30ed1.zip
chromium_src-c9336d2894620ea2fb48fd658dc1d26ef6b30ed1.tar.gz
chromium_src-c9336d2894620ea2fb48fd658dc1d26ef6b30ed1.tar.bz2
SpdySession now closes all streams on receiving GoAway stream.
BUG=none TEST=none Review URL: http://codereview.chromium.org/3109001 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@55506 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/spdy')
-rw-r--r--net/spdy/spdy_network_transaction_unittest.cc48
-rw-r--r--net/spdy/spdy_session.cc19
2 files changed, 19 insertions, 48 deletions
diff --git a/net/spdy/spdy_network_transaction_unittest.cc b/net/spdy/spdy_network_transaction_unittest.cc
index 8ffa81d..8f0d5fc 100644
--- a/net/spdy/spdy_network_transaction_unittest.cc
+++ b/net/spdy/spdy_network_transaction_unittest.cc
@@ -3623,61 +3623,15 @@ TEST_P(SpdyNetworkTransactionTest, GoAwayWithActiveStream) {
MockRead(true, 0, 0), // EOF
};
- // Because the server is telling us to GOAWAY without finishing, the browser
- // will attempt to re-establish.
- scoped_ptr<spdy::SpdyFrame> resp(ConstructSpdyGetSynReply(NULL, 0, 1));
- scoped_ptr<spdy::SpdyFrame> body(ConstructSpdyBodyFrame(1, true));
- MockRead reads2[] = {
- CreateMockRead(*resp),
- CreateMockRead(*body),
- MockRead(true, 0, 0), // EOF
- };
-
scoped_refptr<DelayedSocketData> data(
new DelayedSocketData(1, reads, arraysize(reads),
writes, arraysize(writes)));
- scoped_refptr<DelayedSocketData> data2(
- new DelayedSocketData(1, reads2, arraysize(reads2),
- writes, arraysize(writes)));
NormalSpdyTransactionHelper helper(CreateGetRequest(),
BoundNetLog(), GetParam());
helper.AddData(data);
- helper.AddData(data2);
helper.RunToCompletion(data.get());
TransactionHelperResult out = helper.output();
- EXPECT_EQ(OK, out.rv);
-}
-
-TEST_P(SpdyNetworkTransactionTest, GoAwayWithActiveStreamFail) {
- scoped_ptr<spdy::SpdyFrame> req(ConstructSpdyGet(NULL, 0, false, 1, LOWEST));
- MockWrite writes[] = { CreateMockWrite(*req) };
-
- scoped_ptr<spdy::SpdyFrame> go_away(ConstructSpdyGoAway());
- MockRead reads[] = {
- CreateMockRead(*go_away),
- MockRead(true, 0, 0), // EOF
- };
-
- // Because the server is telling us to GOAWAY without finishing, the browser
- // will attempt to re-establish. On the second connection, just close. This
- // should trigger the ERR_CONNECTION_CLOSED status.
- MockRead reads2[] = {
- MockRead(true, 0, 0), // EOF
- };
-
- scoped_refptr<DelayedSocketData> data(
- new DelayedSocketData(1, reads, arraysize(reads),
- writes, arraysize(writes)));
- scoped_refptr<DelayedSocketData> data2(
- new DelayedSocketData(1, reads2, arraysize(reads2),
- writes, arraysize(writes)));
- NormalSpdyTransactionHelper helper(CreateGetRequest(),
- BoundNetLog(), GetParam());
- helper.AddData(data);
- helper.AddData(data2);
- helper.RunToCompletion(data.get());
- TransactionHelperResult out = helper.output();
- EXPECT_EQ(ERR_CONNECTION_CLOSED, out.rv);
+ EXPECT_EQ(ERR_ABORTED, out.rv);
}
TEST_P(SpdyNetworkTransactionTest, CloseWithActiveStream) {
diff --git a/net/spdy/spdy_session.cc b/net/spdy/spdy_session.cc
index 816cb14..549dd53 100644
--- a/net/spdy/spdy_session.cc
+++ b/net/spdy/spdy_session.cc
@@ -1156,7 +1156,23 @@ void SpdySession::OnRst(const spdy::SpdyRstStreamControlFrame& frame) {
void SpdySession::OnGoAway(const spdy::SpdyGoAwayControlFrame& frame) {
LOG(INFO) << "Spdy GOAWAY for session[" << this << "] for " <<
host_port_pair().ToString();
-
+ if(!active_streams_.empty() || !unclaimed_pushed_streams_.empty()) {
+ LOG(ERROR) << "Spdy GOAWAY received with " << active_streams_.size()
+ << " streams still active.";
+ LOG(ERROR) << "Spdy GOAWAY received with "
+ << unclaimed_pushed_streams_.size()
+ << " unclaimed push streams.";
+ net_log_.AddEvent(
+ NetLog::TYPE_SPDY_SESSION_GOAWAY,
+ new NetLogIntegerParameter(
+ "number of streams still active: ",
+ active_streams_.size()));
+ net_log_.AddEvent(
+ NetLog::TYPE_SPDY_SESSION_GOAWAY,
+ new NetLogIntegerParameter(
+ "number of unclaimed push streams: ",
+ unclaimed_pushed_streams_.size()));
+ }
net_log_.AddEvent(
NetLog::TYPE_SPDY_SESSION_GOAWAY,
new NetLogIntegerParameter(
@@ -1164,6 +1180,7 @@ void SpdySession::OnGoAway(const spdy::SpdyGoAwayControlFrame& frame) {
frame.last_accepted_stream_id()));
RemoveFromPool();
+ CloseAllStreams(net::ERR_ABORTED);
// TODO(willchan): Cancel any streams that are past the GoAway frame's
// |last_accepted_stream_id|.