Index: remoting/host/heartbeat_sender.h |
diff --git a/remoting/host/heartbeat_sender.h b/remoting/host/heartbeat_sender.h |
index 73080be9a6d3683cf1cb3c2869214f3477206fe9..fee2912d5ee57f3710fc1d957203681a0db1ab4b 100644 |
--- a/remoting/host/heartbeat_sender.h |
+++ b/remoting/host/heartbeat_sender.h |
@@ -19,6 +19,7 @@ |
namespace base { |
class MessageLoopProxy; |
+class TimeDelta; |
} // namespace base |
namespace buzz { |
@@ -95,21 +96,23 @@ class HeartbeatSender : public SignalStrategy::Listener { |
const base::Closure& on_unknown_host_id_error, |
const std::string& host_id, |
SignalStrategy* signal_strategy, |
- scoped_refptr<RsaKeyPair> key_pair, |
+ const scoped_refptr<const RsaKeyPair>& key_pair, |
const std::string& directory_bot_jid); |
~HeartbeatSender() override; |
- // Sets host offline reason for future heartbeat stanzas, |
- // as well as intiates sending a stanza right away. |
+ // Sets host offline reason for future heartbeat stanzas, as well as |
+ // intiates sending a stanza right away. |
Lambros
2014/12/16 02:14:05
typo: initiates (maybe "initiating"? Or better: ".
Łukasz Anforowicz
2014/12/17 18:02:04
Done.
|
// |
- // See rem:host-offline-reason class-level comments for discussion |
- // of allowed values for |host_offline_reason| string. |
+ // See rem:host-offline-reason class-level comments for discussion of |
Lambros
2014/12/16 02:14:05
nit: What is "rem:host-offline-reason"? If it's an
Łukasz Anforowicz
2014/12/17 18:02:04
This is an xml attribute referred to in the class-
|
+ // allowed values for |host_offline_reason| string. |
// |
- // |ack_callback| will be called once, when the bot acks |
- // receiving the |host_offline_reason|. |
+ // |ack_callback| will be called once, when the bot acks receiving the |
+ // |host_offline_reason| or when |timeout| is reached. |
+ enum AckOrTimeout { Ack, Timeout }; |
Wez
2014/12/18 00:46:20
Elsewhere we just return a |bool success| paramete
Łukasz Anforowicz
2014/12/18 19:02:33
Seemed cleaner this way (i.e. Timeout is more read
|
void SetHostOfflineReason( |
const std::string& host_offline_reason, |
- const base::Closure& ack_callback); |
+ const base::TimeDelta& timeout, |
+ const base::Callback<void(AckOrTimeout)>& ack_callback); |
// SignalStrategy::Listener interface. |
void OnSignalStrategyStateChange(SignalStrategy::State state) override; |
@@ -131,6 +134,7 @@ class HeartbeatSender : public SignalStrategy::Listener { |
const buzz::XmlElement* response); |
void SetInterval(int interval); |
void SetSequenceId(int sequence_id); |
+ void CallHostOfflineReasonAckCallback(AckOrTimeout ack_or_timeout); |
// Helper methods used by DoSendStanza() to generate heartbeat stanzas. |
scoped_ptr<buzz::XmlElement> CreateHeartbeatMessage(); |
@@ -140,7 +144,7 @@ class HeartbeatSender : public SignalStrategy::Listener { |
base::Closure on_unknown_host_id_error_; |
std::string host_id_; |
SignalStrategy* signal_strategy_; |
- scoped_refptr<RsaKeyPair> key_pair_; |
+ scoped_refptr<const RsaKeyPair> key_pair_; |
std::string directory_bot_jid_; |
scoped_ptr<IqSender> iq_sender_; |
scoped_ptr<IqRequest> request_; |
@@ -153,7 +157,8 @@ class HeartbeatSender : public SignalStrategy::Listener { |
bool heartbeat_succeeded_; |
int failed_startup_heartbeat_count_; |
std::string host_offline_reason_; |
- base::Closure host_offline_reason_ack_callback_; |
+ base::Callback<void(AckOrTimeout)> host_offline_reason_ack_callback_; |
+ base::OneShotTimer<HeartbeatSender> host_offline_reason_timeout_timer_; |
Lambros
2014/12/16 02:14:05
Maybe just host_offline_reason_timer_?
Łukasz Anforowicz
2014/12/17 18:02:04
I think I'll just leave the current name - more ac
|
base::ThreadChecker thread_checker_; |