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

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: 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..59d03d7093d1247899e98086f9819baa3498e117 100644
--- a/remoting/host/heartbeat_sender.cc
+++ b/remoting/host/heartbeat_sender.cc
@@ -13,6 +13,7 @@
#include "remoting/jingle_glue/iq_sender.h"
#include "remoting/jingle_glue/jingle_thread.h"
#include "remoting/jingle_glue/signal_strategy.h"
+#include "remoting/protocol/jingle_messages.h"
Sergey Ulanov 2012/01/31 02:37:13 don't need this include.
Lambros 2012/01/31 21:57:29 Done.
#include "third_party/libjingle/source/talk/xmllite/xmlelement.h"
#include "third_party/libjingle/source/talk/xmpp/constants.h"
@@ -28,6 +29,9 @@ const char kHostIdAttr[] = "hostid";
const char kHeartbeatSignatureTag[] = "signature";
const char kSignatureTimeAttr[] = "time";
+const char kErrorTag[] = "error";
Sergey Ulanov 2012/01/31 02:37:13 IMO it is not necessary to define it here if it is
Wez 2012/01/31 05:44:03 We may as well define it, for consistency with the
Sergey Ulanov 2012/01/31 07:41:35 Or alternatively we could remove other constants t
Lambros 2012/01/31 21:57:29 Normally, I'd agree that defining a constant for s
+const char kNotFoundTag[] = "item-not-found";
+
const char kHeartbeatResultTag[] = "heartbeat-result";
const char kSetIntervalTag[] = "set-interval";
@@ -80,8 +84,20 @@ 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(remoting::protocol::kJabberNamespace,
Sergey Ulanov 2012/01/31 02:37:13 You can use buzz::NS_CLIENT here instead to be con
Lambros 2012/01/31 21:57:29 Done.
+ kErrorTag));
+ if (error_element) {
+ if (error_element->FirstNamed(QName(buzz::NS_STANZA, kNotFoundTag))) {
+ // TODO(lambroslambrou): Trigger an application-defined callback to
+ // shut down the host properly, instead of just exiting here.
Wez 2012/01/31 05:44:03 Create a Type-Cleanup bug for this and include the
Lambros 2012/01/31 21:57:29 Done.
+ LOG(ERROR) << "Received error: Host ID invalid";
+ exit(1);
Wez 2012/01/31 05:44:03 I think this should be _exit(1), so that destructo
Sergey Ulanov 2012/01/31 07:41:35 As I understand the only difference is that _exit(
Lambros 2012/01/31 21:57:29 I think exit() is fine here. It will run atexit()
+ }
+ }
+
LOG(ERROR) << "Received error in response to heartbeat: "
- << response->Str();
+ << response->Str();
Sergey Ulanov 2012/01/31 02:37:13 revert this?
Lambros 2012/01/31 21:57:29 Done.
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