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

Side by Side Diff: remoting/host/heartbeat_sender.cc

Issue 9452038: Implement timeouts for IQ requests. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix release build Created 8 years, 9 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « remoting/host/heartbeat_sender.h ('k') | remoting/host/heartbeat_sender_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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(const XmlElement* response) { 109 void HeartbeatSender::ProcessResponse(IqRequest* request,
110 const XmlElement* response) {
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 const XmlElement* error_element = 113 const XmlElement* error_element =
113 response->FirstNamed(QName(buzz::NS_CLIENT, kErrorTag)); 114 response->FirstNamed(QName(buzz::NS_CLIENT, kErrorTag));
114 if (error_element) { 115 if (error_element) {
115 if (error_element->FirstNamed(QName(buzz::NS_STANZA, kNotFoundTag))) { 116 if (error_element->FirstNamed(QName(buzz::NS_STANZA, kNotFoundTag))) {
116 // TODO(lambroslambrou): Trigger an application-defined callback to 117 // TODO(lambroslambrou): Trigger an application-defined callback to
117 // shut down the host properly, instead of just exiting here 118 // shut down the host properly, instead of just exiting here
118 // (http://crbug.com/112160). 119 // (http://crbug.com/112160).
119 LOG(ERROR) << "Received error: Host ID invalid"; 120 LOG(ERROR) << "Received error: Host ID invalid";
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
223 224
224 std::string message = signal_strategy_->GetLocalJid() + ' ' + 225 std::string message = signal_strategy_->GetLocalJid() + ' ' +
225 base::IntToString(sequence_id_); 226 base::IntToString(sequence_id_);
226 std::string signature(key_pair_->GetSignature(message)); 227 std::string signature(key_pair_->GetSignature(message));
227 signature_tag->AddText(signature); 228 signature_tag->AddText(signature);
228 229
229 return signature_tag.Pass(); 230 return signature_tag.Pass();
230 } 231 }
231 232
232 } // namespace remoting 233 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/host/heartbeat_sender.h ('k') | remoting/host/heartbeat_sender_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698