summaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authormbelshe@google.com <mbelshe@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-12-10 18:04:12 +0000
committermbelshe@google.com <mbelshe@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-12-10 18:04:12 +0000
commit353f616bcb4cb5eb4b864ae174b2a5a9edcc1af0 (patch)
treeb6a746044b5afe79257181897ab3030b6f07d32c /net
parent3119ce5077642340b0815e7d57170f92db5df53c (diff)
downloadchromium_src-353f616bcb4cb5eb4b864ae174b2a5a9edcc1af0.zip
chromium_src-353f616bcb4cb5eb4b864ae174b2a5a9edcc1af0.tar.gz
chromium_src-353f616bcb4cb5eb4b864ae174b2a5a9edcc1af0.tar.bz2
If the server closes the connection and we're aborting streams,
we need to inform the stream of the error so that we don't continue processing through the loop. BUG=none TEST=none Review URL: http://codereview.chromium.org/479013 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@34260 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net')
-rw-r--r--net/flip/flip_session.cc21
-rw-r--r--net/flip/flip_session.h4
2 files changed, 16 insertions, 9 deletions
diff --git a/net/flip/flip_session.cc b/net/flip/flip_session.cc
index 891d1cd..5a902de 100644
--- a/net/flip/flip_session.cc
+++ b/net/flip/flip_session.cc
@@ -386,7 +386,8 @@ void FlipSession::OnTCPConnect(int result) {
LOG(INFO) << "Flip socket connected (result=" << result << ")";
if (result != net::OK) {
- CloseSession(static_cast<net::Error>(result));
+ DCHECK_LT(result, 0);
+ CloseSessionOnError(static_cast<net::Error>(result));
return;
}
@@ -439,8 +440,8 @@ void FlipSession::OnSSLConnect(int result) {
WriteSocketLater();
ReadSocket();
} else {
- DCHECK(result <= 0); // It should be an error, not a byte count.
- CloseSession(static_cast<net::Error>(result));
+ DCHECK_LT(result, 0); // It should be an error, not a byte count.
+ CloseSessionOnError(static_cast<net::Error>(result));
}
}
@@ -455,7 +456,10 @@ void FlipSession::OnReadComplete(int bytes_read) {
if (bytes_read <= 0) {
// Session is tearing down.
- CloseSession(static_cast<net::Error>(bytes_read));
+ net::Error error = static_cast<net::Error>(bytes_read);
+ if (error == OK)
+ error = ERR_CONNECTION_CLOSED;
+ CloseSessionOnError(error);
return;
}
@@ -518,7 +522,7 @@ void FlipSession::OnWriteComplete(int result) {
in_flight_write_.release();
// The stream is now errored. Close it down.
- CloseSession(static_cast<net::Error>(result));
+ CloseSessionOnError(static_cast<net::Error>(result));
}
}
@@ -663,8 +667,9 @@ int FlipSession::GetNewStreamId() {
return id;
}
-void FlipSession::CloseSession(net::Error err) {
- LOG(INFO) << "Flip::CloseSession(" << err << ")";
+void FlipSession::CloseSessionOnError(net::Error err) {
+ DCHECK_LT(err, OK);
+ LOG(INFO) << "Flip::CloseSessionOnError(" << err << ")";
// Don't close twice. This can occur because we can have both
// a read and a write outstanding, and each can complete with
@@ -733,7 +738,7 @@ void FlipSession::GetSSLInfo(SSLInfo* ssl_info) {
void FlipSession::OnError(flip::FlipFramer* framer) {
LOG(ERROR) << "FlipSession error: " << framer->error_code();
- CloseSession(net::ERR_UNEXPECTED);
+ CloseSessionOnError(net::ERR_UNEXPECTED);
}
void FlipSession::OnStreamFrameData(flip::FlipStreamId stream_id,
diff --git a/net/flip/flip_session.h b/net/flip/flip_session.h
index d1090ce..ff9a324 100644
--- a/net/flip/flip_session.h
+++ b/net/flip/flip_session.h
@@ -139,7 +139,9 @@ class FlipSession : public base::RefCounted<FlipSession>,
// Closes this session. This will close all active streams and mark
// the session as permanently closed.
- void CloseSession(net::Error err);
+ // |err| should not be OK; this function is intended to be called on
+ // error.
+ void CloseSessionOnError(net::Error err);
// Track active streams in the active stream list.
void ActivateStream(FlipStream* stream);