| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "remoting/host/heartbeat_sender.h" | 5 #include "remoting/host/heartbeat_sender.h" |
| 6 | 6 |
| 7 #include <math.h> | 7 #include <math.h> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 | 99 |
| 100 void HeartbeatSender::DoSendStanza() { | 100 void HeartbeatSender::DoSendStanza() { |
| 101 VLOG(1) << "Sending heartbeat stanza to " << kChromotingBotJid; | 101 VLOG(1) << "Sending heartbeat stanza to " << kChromotingBotJid; |
| 102 request_ = iq_sender_->SendIq( | 102 request_ = iq_sender_->SendIq( |
| 103 buzz::STR_SET, kChromotingBotJid, CreateHeartbeatMessage(), | 103 buzz::STR_SET, kChromotingBotJid, CreateHeartbeatMessage(), |
| 104 base::Bind(&HeartbeatSender::ProcessResponse, | 104 base::Bind(&HeartbeatSender::ProcessResponse, |
| 105 base::Unretained(this))); | 105 base::Unretained(this))); |
| 106 ++sequence_id_; | 106 ++sequence_id_; |
| 107 } | 107 } |
| 108 | 108 |
| 109 void HeartbeatSender::ProcessResponse(IqRequest* request, | 109 void HeartbeatSender::ProcessResponse(const XmlElement* response) { |
| 110 const XmlElement* response) { | |
| 111 std::string type = response->Attr(buzz::QN_TYPE); | 110 std::string type = response->Attr(buzz::QN_TYPE); |
| 112 if (type == buzz::STR_ERROR) { | 111 if (type == buzz::STR_ERROR) { |
| 113 const XmlElement* error_element = | 112 const XmlElement* error_element = |
| 114 response->FirstNamed(QName(buzz::NS_CLIENT, kErrorTag)); | 113 response->FirstNamed(QName(buzz::NS_CLIENT, kErrorTag)); |
| 115 if (error_element) { | 114 if (error_element) { |
| 116 if (error_element->FirstNamed(QName(buzz::NS_STANZA, kNotFoundTag))) { | 115 if (error_element->FirstNamed(QName(buzz::NS_STANZA, kNotFoundTag))) { |
| 117 // TODO(lambroslambrou): Trigger an application-defined callback to | 116 // TODO(lambroslambrou): Trigger an application-defined callback to |
| 118 // shut down the host properly, instead of just exiting here | 117 // shut down the host properly, instead of just exiting here |
| 119 // (http://crbug.com/112160). | 118 // (http://crbug.com/112160). |
| 120 LOG(ERROR) << "Received error: Host ID invalid"; | 119 LOG(ERROR) << "Received error: Host ID invalid"; |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 224 | 223 |
| 225 std::string message = signal_strategy_->GetLocalJid() + ' ' + | 224 std::string message = signal_strategy_->GetLocalJid() + ' ' + |
| 226 base::IntToString(sequence_id_); | 225 base::IntToString(sequence_id_); |
| 227 std::string signature(key_pair_->GetSignature(message)); | 226 std::string signature(key_pair_->GetSignature(message)); |
| 228 signature_tag->AddText(signature); | 227 signature_tag->AddText(signature); |
| 229 | 228 |
| 230 return signature_tag.Pass(); | 229 return signature_tag.Pass(); |
| 231 } | 230 } |
| 232 | 231 |
| 233 } // namespace remoting | 232 } // namespace remoting |
| OLD | NEW |