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

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

Issue 12316083: Move HostKeyPair into protocol::KeyPair. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Rebase Created 7 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
« 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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
44 const int64 kResendDelayMs = 10 * 1000; // 10 seconds. 44 const int64 kResendDelayMs = 10 * 1000; // 10 seconds.
45 const int64 kResendDelayOnHostNotFoundMs = 10 * 1000; // 10 seconds. 45 const int64 kResendDelayOnHostNotFoundMs = 10 * 1000; // 10 seconds.
46 const int kMaxResendOnHostNotFoundCount = 12; // 2 minutes (12 x 10 seconds). 46 const int kMaxResendOnHostNotFoundCount = 12; // 2 minutes (12 x 10 seconds).
47 47
48 } // namespace 48 } // namespace
49 49
50 HeartbeatSender::HeartbeatSender( 50 HeartbeatSender::HeartbeatSender(
51 Listener* listener, 51 Listener* listener,
52 const std::string& host_id, 52 const std::string& host_id,
53 SignalStrategy* signal_strategy, 53 SignalStrategy* signal_strategy,
54 HostKeyPair* key_pair, 54 scoped_refptr<RsaKeyPair> key_pair,
55 const std::string& directory_bot_jid) 55 const std::string& directory_bot_jid)
56 : listener_(listener), 56 : listener_(listener),
57 host_id_(host_id), 57 host_id_(host_id),
58 signal_strategy_(signal_strategy), 58 signal_strategy_(signal_strategy),
59 key_pair_(key_pair), 59 key_pair_(key_pair),
60 directory_bot_jid_(directory_bot_jid), 60 directory_bot_jid_(directory_bot_jid),
61 interval_ms_(kDefaultHeartbeatIntervalMs), 61 interval_ms_(kDefaultHeartbeatIntervalMs),
62 sequence_id_(0), 62 sequence_id_(0),
63 sequence_id_was_set_(false), 63 sequence_id_was_set_(false),
64 sequence_id_recent_set_num_(0), 64 sequence_id_recent_set_num_(0),
(...skipping 192 matching lines...) Expand 10 before | Expand all | Expand 10 after
257 heartbeat->AddElement(log.release()); 257 heartbeat->AddElement(log.release());
258 return heartbeat.Pass(); 258 return heartbeat.Pass();
259 } 259 }
260 260
261 scoped_ptr<XmlElement> HeartbeatSender::CreateSignature() { 261 scoped_ptr<XmlElement> HeartbeatSender::CreateSignature() {
262 scoped_ptr<XmlElement> signature_tag(new XmlElement( 262 scoped_ptr<XmlElement> signature_tag(new XmlElement(
263 QName(kChromotingXmlNamespace, kHeartbeatSignatureTag))); 263 QName(kChromotingXmlNamespace, kHeartbeatSignatureTag)));
264 264
265 std::string message = signal_strategy_->GetLocalJid() + ' ' + 265 std::string message = signal_strategy_->GetLocalJid() + ' ' +
266 base::IntToString(sequence_id_); 266 base::IntToString(sequence_id_);
267 std::string signature(key_pair_->GetSignature(message)); 267 std::string signature(key_pair_->SignMessage(message));
268 signature_tag->AddText(signature); 268 signature_tag->AddText(signature);
269 269
270 return signature_tag.Pass(); 270 return signature_tag.Pass();
271 } 271 }
272 272
273 } // namespace remoting 273 } // 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