OLD | NEW |
---|---|
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "base/logging.h" | 7 #include "base/logging.h" |
8 #include "base/message_loop.h" | 8 #include "base/message_loop.h" |
9 #include "base/string_number_conversions.h" | 9 #include "base/string_number_conversions.h" |
10 #include "base/time.h" | 10 #include "base/time.h" |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
74 request_.reset(signal_strategy->CreateIqRequest()); | 74 request_.reset(signal_strategy->CreateIqRequest()); |
75 request_->set_callback(NewCallback(this, &HeartbeatSender::ProcessResponse)); | 75 request_->set_callback(NewCallback(this, &HeartbeatSender::ProcessResponse)); |
76 | 76 |
77 DoSendStanza(); | 77 DoSendStanza(); |
78 timer_.Start(base::TimeDelta::FromMilliseconds(interval_ms_), this, | 78 timer_.Start(base::TimeDelta::FromMilliseconds(interval_ms_), this, |
79 &HeartbeatSender::DoSendStanza); | 79 &HeartbeatSender::DoSendStanza); |
80 } | 80 } |
81 | 81 |
82 void HeartbeatSender::OnSignallingDisconnected() { | 82 void HeartbeatSender::OnSignallingDisconnected() { |
83 DCHECK_EQ(MessageLoop::current(), message_loop_); | 83 DCHECK_EQ(MessageLoop::current(), message_loop_); |
84 DCHECK_EQ(state_, STARTED); | 84 if (state_ == STARTED) { |
85 state_ = STOPPED; | 85 state_ = STOPPED; |
86 request_.reset(NULL); | 86 request_.reset(NULL); |
Wez
2011/07/06 22:45:15
This change means that the heart-beat request only
| |
87 } | |
87 } | 88 } |
88 | 89 |
89 // Ignore any notifications other than signalling | 90 // Ignore any notifications other than signalling |
90 // connected/disconnected events. | 91 // connected/disconnected events. |
91 void HeartbeatSender::OnAccessDenied() { } | 92 void HeartbeatSender::OnAccessDenied() { } |
92 void HeartbeatSender::OnAuthenticatedClientsChanged(int clients) { } | 93 void HeartbeatSender::OnAuthenticatedClientsChanged(int clients) { } |
93 void HeartbeatSender::OnShutdown() { } | 94 void HeartbeatSender::OnShutdown() { } |
94 | 95 |
95 void HeartbeatSender::DoSendStanza() { | 96 void HeartbeatSender::DoSendStanza() { |
96 DCHECK_EQ(MessageLoop::current(), message_loop_); | 97 DCHECK_EQ(MessageLoop::current(), message_loop_); |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
163 QName(kChromotingXmlNamespace, kSignatureTimeAttr), time_str); | 164 QName(kChromotingXmlNamespace, kSignatureTimeAttr), time_str); |
164 | 165 |
165 std::string message = full_jid_ + ' ' + time_str; | 166 std::string message = full_jid_ + ' ' + time_str; |
166 std::string signature(key_pair_.GetSignature(message)); | 167 std::string signature(key_pair_.GetSignature(message)); |
167 signature_tag->AddText(signature); | 168 signature_tag->AddText(signature); |
168 | 169 |
169 return signature_tag; | 170 return signature_tag; |
170 } | 171 } |
171 | 172 |
172 } // namespace remoting | 173 } // namespace remoting |
OLD | NEW |