summaryrefslogtreecommitdiffstats
path: root/net/flip/flip_session.h
diff options
context:
space:
mode:
authormbelshe@google.com <mbelshe@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-12-01 01:16:39 +0000
committermbelshe@google.com <mbelshe@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2009-12-01 01:16:39 +0000
commit60253bdae0411c6660b907744d10174a3c7d524a (patch)
tree40db39f863762a39f83c7dac51756c34fdf0dfc5 /net/flip/flip_session.h
parent5504659233d587e9d0ec458be3da5ee0085f4dff (diff)
downloadchromium_src-60253bdae0411c6660b907744d10174a3c7d524a.zip
chromium_src-60253bdae0411c6660b907744d10174a3c7d524a.tar.gz
chromium_src-60253bdae0411c6660b907744d10174a3c7d524a.tar.bz2
Fix FlipSession cleanup to be unified through CloseSession. Because Flip is
full duplex, a closed socket will cause both read and write completions. Unifying the cleanup code allows both codepaths to safely cleanup the socket. In the process, consolidated several flags on the session into a single State variable. BUG=29004 TEST=WriteError Review URL: http://codereview.chromium.org/450025 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@33404 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'net/flip/flip_session.h')
-rw-r--r--net/flip/flip_session.h19
1 files changed, 17 insertions, 2 deletions
diff --git a/net/flip/flip_session.h b/net/flip/flip_session.h
index 7555b85..545b902 100644
--- a/net/flip/flip_session.h
+++ b/net/flip/flip_session.h
@@ -75,6 +75,13 @@ class FlipSession : public base::RefCounted<FlipSession>,
protected:
friend class FlipSessionPool;
+ enum State {
+ IDLE,
+ CONNECTING,
+ CONNECTED,
+ CLOSED
+ };
+
// Provide access to the framer for testing.
flip::FlipFramer* GetFramer() { return &flip_framer_; }
@@ -125,6 +132,10 @@ class FlipSession : public base::RefCounted<FlipSession>,
// Get a new stream id.
int GetNewStreamId();
+ // Closes this session. This will close all active streams and mark
+ // the session as permanently closed.
+ void CloseSession(net::Error err);
+
// Track active streams in the active stream list.
void ActivateStream(FlipStream* stream);
void DeactivateStream(flip::FlipStreamId id);
@@ -149,8 +160,6 @@ class FlipSession : public base::RefCounted<FlipSession>,
// The socket handle for this session.
ClientSocketHandle connection_;
- bool connection_started_; // Is the connect process started.
- bool connection_ready_; // Is the connection ready for use.
// The read buffer used to read data from the socket.
scoped_refptr<IOBuffer> read_buffer_;
@@ -192,6 +201,12 @@ class FlipSession : public base::RefCounted<FlipSession>,
// Flip Frame state.
flip::FlipFramer flip_framer_;
+ // If an error has occurred on the session, the session is effectively
+ // dead. Record this error here. When no error has occurred, |error_| will
+ // be OK.
+ net::Error error_;
+ State state_;
+
static bool use_ssl_;
};