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; |
} |