Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(381)

Unified Diff: remoting/protocol/connection_to_host.cc

Issue 7218061: Close all writers before JingleSession is destroyed. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix tests Created 9 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « remoting/protocol/connection_to_host.h ('k') | remoting/protocol/host_control_sender.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/protocol/connection_to_host.cc
diff --git a/remoting/protocol/connection_to_host.cc b/remoting/protocol/connection_to_host.cc
index 03f388ce0ab2fe9ece333ce048589157e1c76dbe..ae9b999756325db1731c97f33a086fafe50409da 100644
--- a/remoting/protocol/connection_to_host.cc
+++ b/remoting/protocol/connection_to_host.cc
@@ -44,11 +44,11 @@ ConnectionToHost::~ConnectionToHost() {
}
InputStub* ConnectionToHost::input_stub() {
- return input_stub_.get();
+ return input_sender_.get();
}
HostStub* ConnectionToHost::host_stub() {
- return host_stub_.get();
+ return host_control_sender_.get();
}
void ConnectionToHost::Connect(scoped_refptr<XmppProxy> xmpp_proxy,
@@ -84,6 +84,8 @@ void ConnectionToHost::Disconnect(const base::Closure& shutdown_task) {
return;
}
+ CloseChannels();
+
if (session_) {
session_->Close(
NewRunnableMethod(this, &ConnectionToHost::OnDisconnected,
@@ -187,11 +189,13 @@ void ConnectionToHost::OnSessionStateChange(
switch (state) {
case Session::FAILED:
state_ = STATE_FAILED;
+ CloseChannels();
event_callback_->OnConnectionFailed(this);
break;
case Session::CLOSED:
state_ = STATE_CLOSED;
+ CloseChannels();
event_callback_->OnConnectionClosed(this);
break;
@@ -200,7 +204,8 @@ void ConnectionToHost::OnSessionStateChange(
// Initialize reader and writer.
video_reader_.reset(VideoReader::Create(session_->config()));
video_reader_->Init(session_, video_stub_);
- host_stub_.reset(new HostControlSender(session_->control_channel()));
+ host_control_sender_.reset(
+ new HostControlSender(session_->control_channel()));
dispatcher_->Initialize(session_.get(), client_stub_);
event_callback_->OnConnectionOpened(this);
break;
@@ -211,13 +216,21 @@ void ConnectionToHost::OnSessionStateChange(
}
}
+void ConnectionToHost::CloseChannels() {
+ if (input_sender_.get())
+ input_sender_->Close();
+
+ if (host_control_sender_.get())
+ host_control_sender_->Close();
+}
+
void ConnectionToHost::OnClientAuthenticated() {
// TODO(hclam): Don't send anything except authentication request if it is
// not authenticated.
state_ = STATE_AUTHENTICATED;
// Create and enable the input stub now that we're authenticated.
- input_stub_.reset(new InputSender(session_->event_channel()));
+ input_sender_.reset(new InputSender(session_->event_channel()));
}
ConnectionToHost::State ConnectionToHost::state() const {
« no previous file with comments | « remoting/protocol/connection_to_host.h ('k') | remoting/protocol/host_control_sender.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698