| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/logging.h" | 8 #include "base/logging.h" |
| 9 #include "base/message_loop_proxy.h" | 9 #include "base/message_loop_proxy.h" |
| 10 #include "base/string_number_conversions.h" | 10 #include "base/string_number_conversions.h" |
| (...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 94 remoting::protocol::ConnectionToClient* client) { } | 94 remoting::protocol::ConnectionToClient* client) { } |
| 95 void HeartbeatSender::OnClientDisconnected( | 95 void HeartbeatSender::OnClientDisconnected( |
| 96 remoting::protocol::ConnectionToClient* client) { } | 96 remoting::protocol::ConnectionToClient* client) { } |
| 97 void HeartbeatSender::OnShutdown() { } | 97 void HeartbeatSender::OnShutdown() { } |
| 98 | 98 |
| 99 void HeartbeatSender::DoSendStanza() { | 99 void HeartbeatSender::DoSendStanza() { |
| 100 DCHECK(message_loop_->BelongsToCurrentThread()); | 100 DCHECK(message_loop_->BelongsToCurrentThread()); |
| 101 DCHECK_EQ(state_, STARTED); | 101 DCHECK_EQ(state_, STARTED); |
| 102 | 102 |
| 103 VLOG(1) << "Sending heartbeat stanza to " << kChromotingBotJid; | 103 VLOG(1) << "Sending heartbeat stanza to " << kChromotingBotJid; |
| 104 request_->SendIq(buzz::STR_SET, kChromotingBotJid, CreateHeartbeatMessage()); | 104 request_->SendIq(IqRequest::MakeIqStanza( |
| 105 buzz::STR_SET, kChromotingBotJid, CreateHeartbeatMessage())); |
| 105 } | 106 } |
| 106 | 107 |
| 107 void HeartbeatSender::ProcessResponse(const XmlElement* response) { | 108 void HeartbeatSender::ProcessResponse(const XmlElement* response) { |
| 108 DCHECK(message_loop_->BelongsToCurrentThread()); | 109 DCHECK(message_loop_->BelongsToCurrentThread()); |
| 109 | 110 |
| 110 std::string type = response->Attr(buzz::QN_TYPE); | 111 std::string type = response->Attr(buzz::QN_TYPE); |
| 111 if (type == buzz::STR_ERROR) { | 112 if (type == buzz::STR_ERROR) { |
| 112 LOG(ERROR) << "Received error in response to heartbeat: " | 113 LOG(ERROR) << "Received error in response to heartbeat: " |
| 113 << response->Str(); | 114 << response->Str(); |
| 114 return; | 115 return; |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 167 QName(kChromotingXmlNamespace, kSignatureTimeAttr), time_str); | 168 QName(kChromotingXmlNamespace, kSignatureTimeAttr), time_str); |
| 168 | 169 |
| 169 std::string message = full_jid_ + ' ' + time_str; | 170 std::string message = full_jid_ + ' ' + time_str; |
| 170 std::string signature(key_pair_.GetSignature(message)); | 171 std::string signature(key_pair_.GetSignature(message)); |
| 171 signature_tag->AddText(signature); | 172 signature_tag->AddText(signature); |
| 172 | 173 |
| 173 return signature_tag; | 174 return signature_tag; |
| 174 } | 175 } |
| 175 | 176 |
| 176 } // namespace remoting | 177 } // namespace remoting |
| OLD | NEW |