| 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/message_loop/message_loop_proxy.h" | 10 #include "base/message_loop/message_loop_proxy.h" |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 47 const int64 kResendDelayOnHostNotFoundMs = 10 * 1000; // 10 seconds. | 47 const int64 kResendDelayOnHostNotFoundMs = 10 * 1000; // 10 seconds. |
| 48 const int kMaxResendOnHostNotFoundCount = 12; // 2 minutes (12 x 10 seconds). | 48 const int kMaxResendOnHostNotFoundCount = 12; // 2 minutes (12 x 10 seconds). |
| 49 | 49 |
| 50 } // namespace | 50 } // namespace |
| 51 | 51 |
| 52 HeartbeatSender::HeartbeatSender( | 52 HeartbeatSender::HeartbeatSender( |
| 53 const base::Closure& on_heartbeat_successful_callback, | 53 const base::Closure& on_heartbeat_successful_callback, |
| 54 const base::Closure& on_unknown_host_id_error, | 54 const base::Closure& on_unknown_host_id_error, |
| 55 const std::string& host_id, | 55 const std::string& host_id, |
| 56 SignalStrategy* signal_strategy, | 56 SignalStrategy* signal_strategy, |
| 57 scoped_refptr<RsaKeyPair> key_pair, | 57 const scoped_refptr<const RsaKeyPair>& key_pair, |
| 58 const std::string& directory_bot_jid) | 58 const std::string& directory_bot_jid) |
| 59 : on_heartbeat_successful_callback_(on_heartbeat_successful_callback), | 59 : on_heartbeat_successful_callback_(on_heartbeat_successful_callback), |
| 60 on_unknown_host_id_error_(on_unknown_host_id_error), | 60 on_unknown_host_id_error_(on_unknown_host_id_error), |
| 61 host_id_(host_id), | 61 host_id_(host_id), |
| 62 signal_strategy_(signal_strategy), | 62 signal_strategy_(signal_strategy), |
| 63 key_pair_(key_pair), | 63 key_pair_(key_pair), |
| 64 directory_bot_jid_(directory_bot_jid), | 64 directory_bot_jid_(directory_bot_jid), |
| 65 interval_ms_(kDefaultHeartbeatIntervalMs), | 65 interval_ms_(kDefaultHeartbeatIntervalMs), |
| 66 sequence_id_(0), | 66 sequence_id_(0), |
| 67 sequence_id_was_set_(false), | 67 sequence_id_was_set_(false), |
| (...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 310 | 310 |
| 311 std::string message = signal_strategy_->GetLocalJid() + ' ' + | 311 std::string message = signal_strategy_->GetLocalJid() + ' ' + |
| 312 base::IntToString(sequence_id_); | 312 base::IntToString(sequence_id_); |
| 313 std::string signature(key_pair_->SignMessage(message)); | 313 std::string signature(key_pair_->SignMessage(message)); |
| 314 signature_tag->AddText(signature); | 314 signature_tag->AddText(signature); |
| 315 | 315 |
| 316 return signature_tag.Pass(); | 316 return signature_tag.Pass(); |
| 317 } | 317 } |
| 318 | 318 |
| 319 } // namespace remoting | 319 } // namespace remoting |
| OLD | NEW |