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

Unified Diff: remoting/host/chromoting_host.cc

Issue 3087003: Added HostKeyPair class, signatures for heartbeat messages. (Closed)
Patch Set: - Created 10 years, 5 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/base/constants.cc ('k') | remoting/host/heartbeat_sender.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/host/chromoting_host.cc
diff --git a/remoting/host/chromoting_host.cc b/remoting/host/chromoting_host.cc
index 7795de15c80b99aeb13efa8202c097d217716949..063ee83875ab8f7924c08b1c83e217088da78f5f 100644
--- a/remoting/host/chromoting_host.cc
+++ b/remoting/host/chromoting_host.cc
@@ -139,12 +139,13 @@ void ChromotingHost::OnStateChange(JingleClient* jingle_client,
LOG(INFO) << "Host connected as "
<< jingle_client->GetFullJid() << "." << std::endl;
- // Start heartbeating after we connected
- heartbeat_sender_ = new HeartbeatSender();
- heartbeat_sender_->Start(config_, jingle_client_.get());
+ // Start heartbeating after we've connected.
+ heartbeat_sender_->Start();
} else if (state == JingleClient::CLOSED) {
LOG(INFO) << "Host disconnected from talk network." << std::endl;
- heartbeat_sender_ = NULL;
+
+ // Stop heartbeating.
+ heartbeat_sender_->Stop();
// TODO(sergeyu): We should try reconnecting here instead of terminating
// the host.
@@ -219,6 +220,12 @@ void ChromotingHost::DoStart(Task* shutdown_task) {
jingle_client_ = new JingleClient(context_->jingle_thread());
jingle_client_->Init(xmpp_login, xmpp_auth_token,
kChromotingTokenServiceName, this);
+
+ heartbeat_sender_ = new HeartbeatSender();
+ if (!heartbeat_sender_->Init(config_, jingle_client_.get())) {
+ LOG(ERROR) << "Failed to initialize HeartbeatSender.";
+ return;
+ }
}
void ChromotingHost::DoShutdown() {
« no previous file with comments | « remoting/base/constants.cc ('k') | remoting/host/heartbeat_sender.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698