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 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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), |
65 heartbeat_succeeded_(false), | 65 heartbeat_succeeded_(false), |
66 failed_startup_heartbeat_count_(0) { | 66 failed_startup_heartbeat_count_(0) { |
67 DCHECK(signal_strategy_); | 67 DCHECK(signal_strategy_); |
68 DCHECK(key_pair_); | 68 DCHECK(key_pair_.get()); |
69 | 69 |
70 signal_strategy_->AddListener(this); | 70 signal_strategy_->AddListener(this); |
71 | 71 |
72 // Start heartbeats if the |signal_strategy_| is already connected. | 72 // Start heartbeats if the |signal_strategy_| is already connected. |
73 OnSignalStrategyStateChange(signal_strategy_->GetState()); | 73 OnSignalStrategyStateChange(signal_strategy_->GetState()); |
74 } | 74 } |
75 | 75 |
76 HeartbeatSender::~HeartbeatSender() { | 76 HeartbeatSender::~HeartbeatSender() { |
77 signal_strategy_->RemoveListener(this); | 77 signal_strategy_->RemoveListener(this); |
78 } | 78 } |
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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_->SignMessage(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 |
OLD | NEW |