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

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

Issue 719983002: Reporting of policy errors via host-offline-reason: part 3 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@hor-nohoststatussender
Patch Set: Rebasing... Created 6 years 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
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 #ifndef REMOTING_HOST_HEARTBEAT_SENDER_H_ 5 #ifndef REMOTING_HOST_HEARTBEAT_SENDER_H_
6 #define REMOTING_HOST_HEARTBEAT_SENDER_H_ 6 #define REMOTING_HOST_HEARTBEAT_SENDER_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/callback.h" 10 #include "base/callback.h"
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 // </iq> 88 // </iq>
89 class HeartbeatSender : public SignalStrategy::Listener { 89 class HeartbeatSender : public SignalStrategy::Listener {
90 public: 90 public:
91 // |signal_strategy| and |delegate| must outlive this 91 // |signal_strategy| and |delegate| must outlive this
92 // object. Heartbeats will start when the supplied SignalStrategy 92 // object. Heartbeats will start when the supplied SignalStrategy
93 // enters the CONNECTED state. 93 // enters the CONNECTED state.
94 HeartbeatSender(const base::Closure& on_heartbeat_successful_callback, 94 HeartbeatSender(const base::Closure& on_heartbeat_successful_callback,
95 const base::Closure& on_unknown_host_id_error, 95 const base::Closure& on_unknown_host_id_error,
96 const std::string& host_id, 96 const std::string& host_id,
97 SignalStrategy* signal_strategy, 97 SignalStrategy* signal_strategy,
98 scoped_refptr<RsaKeyPair> key_pair, 98 const scoped_refptr<RsaKeyPair> key_pair,
99 const std::string& directory_bot_jid); 99 const std::string& directory_bot_jid);
100 ~HeartbeatSender() override; 100 ~HeartbeatSender() override;
101 101
102 // Sets host offline reason for future heartbeat stanzas, 102 // Sets host offline reason for future heartbeat stanzas,
103 // as well as intiates sending a stanza right away. 103 // as well as intiates sending a stanza right away.
104 // 104 //
105 // See rem:host-offline-reason class-level comments for discussion 105 // See rem:host-offline-reason class-level comments for discussion
106 // of allowed values for |host_offline_reason| string. 106 // of allowed values for |host_offline_reason| string.
107 // 107 //
108 // |ack_callback| will be called once, when the bot acks 108 // |ack_callback| will be called once, when the bot acks
(...skipping 24 matching lines...) Expand all
133 void SetSequenceId(int sequence_id); 133 void SetSequenceId(int sequence_id);
134 134
135 // Helper methods used by DoSendStanza() to generate heartbeat stanzas. 135 // Helper methods used by DoSendStanza() to generate heartbeat stanzas.
136 scoped_ptr<buzz::XmlElement> CreateHeartbeatMessage(); 136 scoped_ptr<buzz::XmlElement> CreateHeartbeatMessage();
137 scoped_ptr<buzz::XmlElement> CreateSignature(); 137 scoped_ptr<buzz::XmlElement> CreateSignature();
138 138
139 base::Closure on_heartbeat_successful_callback_; 139 base::Closure on_heartbeat_successful_callback_;
140 base::Closure on_unknown_host_id_error_; 140 base::Closure on_unknown_host_id_error_;
141 std::string host_id_; 141 std::string host_id_;
142 SignalStrategy* signal_strategy_; 142 SignalStrategy* signal_strategy_;
143 scoped_refptr<RsaKeyPair> key_pair_; 143 const scoped_refptr<RsaKeyPair> key_pair_;
Lambros 2014/12/02 03:35:22 Why change this?
Łukasz Anforowicz 2014/12/02 20:08:01 The assumption here is that presence of "const" is
Lambros 2014/12/03 03:20:24 But this field is a value type (not a reference or
Łukasz Anforowicz 2014/12/03 17:54:21 You're right. I don't know what I was thinking.
144 std::string directory_bot_jid_; 144 std::string directory_bot_jid_;
145 scoped_ptr<IqSender> iq_sender_; 145 scoped_ptr<IqSender> iq_sender_;
146 scoped_ptr<IqRequest> request_; 146 scoped_ptr<IqRequest> request_;
147 int interval_ms_; 147 int interval_ms_;
148 base::RepeatingTimer<HeartbeatSender> timer_; 148 base::RepeatingTimer<HeartbeatSender> timer_;
149 base::OneShotTimer<HeartbeatSender> timer_resend_; 149 base::OneShotTimer<HeartbeatSender> timer_resend_;
150 int sequence_id_; 150 int sequence_id_;
151 bool sequence_id_was_set_; 151 bool sequence_id_was_set_;
152 int sequence_id_recent_set_num_; 152 int sequence_id_recent_set_num_;
153 bool heartbeat_succeeded_; 153 bool heartbeat_succeeded_;
154 int failed_startup_heartbeat_count_; 154 int failed_startup_heartbeat_count_;
155 std::string host_offline_reason_; 155 std::string host_offline_reason_;
156 base::Closure host_offline_reason_ack_callback_; 156 base::Closure host_offline_reason_ack_callback_;
157 157
158 base::ThreadChecker thread_checker_; 158 base::ThreadChecker thread_checker_;
159 159
160 DISALLOW_COPY_AND_ASSIGN(HeartbeatSender); 160 DISALLOW_COPY_AND_ASSIGN(HeartbeatSender);
161 }; 161 };
162 162
163 } // namespace remoting 163 } // namespace remoting
164 164
165 #endif // REMOTING_HOST_HEARTBEAT_SENDER_H_ 165 #endif // REMOTING_HOST_HEARTBEAT_SENDER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698