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

Unified Diff: remoting/host/heartbeat_sender.cc

Issue 9301026: Virtual Me2Me Host: Exit process if Host ID is invalid. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix nits Created 8 years, 11 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/host/heartbeat_sender.cc
diff --git a/remoting/host/heartbeat_sender.cc b/remoting/host/heartbeat_sender.cc
index f1ba5151360a22e2c3e750518cc2cec7ae65147a..d0eaba58e1d82b0830514f23ae9157d762c4c58a 100644
--- a/remoting/host/heartbeat_sender.cc
+++ b/remoting/host/heartbeat_sender.cc
@@ -28,6 +28,9 @@ const char kHostIdAttr[] = "hostid";
const char kHeartbeatSignatureTag[] = "signature";
const char kSignatureTimeAttr[] = "time";
+const char kErrorTag[] = "error";
+const char kNotFoundTag[] = "item-not-found";
+
const char kHeartbeatResultTag[] = "heartbeat-result";
const char kSetIntervalTag[] = "set-interval";
@@ -80,6 +83,18 @@ void HeartbeatSender::DoSendStanza() {
void HeartbeatSender::ProcessResponse(const XmlElement* response) {
std::string type = response->Attr(buzz::QN_TYPE);
if (type == buzz::STR_ERROR) {
+ const XmlElement* error_element =
+ response->FirstNamed(QName(buzz::NS_CLIENT, kErrorTag));
+ if (error_element) {
+ if (error_element->FirstNamed(QName(buzz::NS_STANZA, kNotFoundTag))) {
Sergey Ulanov 2012/01/31 23:21:41 nit: maybe roll these two if statements together,
+ // TODO(lambroslambrou): Trigger an application-defined callback to
+ // shut down the host properly, instead of just exiting here
+ // (http://crbug.com/112160).
+ LOG(ERROR) << "Received error: Host ID invalid";
+ exit(1);
+ }
+ }
+
LOG(ERROR) << "Received error in response to heartbeat: "
<< response->Str();
return;
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698