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/protocol/libjingle_transport_factory.h" | 5 #include "remoting/protocol/libjingle_transport_factory.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/callback.h" | 9 #include "base/callback.h" |
10 #include "base/callback_helpers.h" | 10 #include "base/callback_helpers.h" |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
143 DCHECK(CalledOnValidThread()); | 143 DCHECK(CalledOnValidThread()); |
144 | 144 |
145 DCHECK(!can_start_); | 145 DCHECK(!can_start_); |
146 can_start_ = true; | 146 can_start_ = true; |
147 | 147 |
148 // If Connect() has been called then start connection. | 148 // If Connect() has been called then start connection. |
149 if (!callback_.is_null()) | 149 if (!callback_.is_null()) |
150 DoStart(); | 150 DoStart(); |
151 | 151 |
152 while (!pending_candidates_.empty()) { | 152 while (!pending_candidates_.empty()) { |
153 channel_->SetRemoteIceCredentials(pending_candidates_.front().username(), | |
154 pending_candidates_.front().password()); | |
jiayl
2015/04/15 20:13:00
Do all candidates share the same username/password
Sergey Ulanov
2015/04/15 20:49:34
Credentials may change when the remote peer restar
| |
153 channel_->OnCandidate(pending_candidates_.front()); | 155 channel_->OnCandidate(pending_candidates_.front()); |
154 pending_candidates_.pop_front(); | 156 pending_candidates_.pop_front(); |
155 } | 157 } |
156 } | 158 } |
157 | 159 |
158 void LibjingleTransport::Connect( | 160 void LibjingleTransport::Connect( |
159 const std::string& name, | 161 const std::string& name, |
160 Transport::EventHandler* event_handler, | 162 Transport::EventHandler* event_handler, |
161 const Transport::ConnectedCallback& callback) { | 163 const Transport::ConnectedCallback& callback) { |
162 DCHECK(CalledOnValidThread()); | 164 DCHECK(CalledOnValidThread()); |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
221 DCHECK(CalledOnValidThread()); | 223 DCHECK(CalledOnValidThread()); |
222 | 224 |
223 // To enforce the no-relay setting, it's not enough to not produce relay | 225 // To enforce the no-relay setting, it's not enough to not produce relay |
224 // candidates. It's also necessary to discard remote relay candidates. | 226 // candidates. It's also necessary to discard remote relay candidates. |
225 bool relay_allowed = (network_settings_.flags & | 227 bool relay_allowed = (network_settings_.flags & |
226 NetworkSettings::NAT_TRAVERSAL_RELAY) != 0; | 228 NetworkSettings::NAT_TRAVERSAL_RELAY) != 0; |
227 if (!relay_allowed && candidate.type() == cricket::RELAY_PORT_TYPE) | 229 if (!relay_allowed && candidate.type() == cricket::RELAY_PORT_TYPE) |
228 return; | 230 return; |
229 | 231 |
230 if (channel_) { | 232 if (channel_) { |
233 channel_->SetRemoteIceCredentials(candidate.username(), | |
234 candidate.password()); | |
231 channel_->OnCandidate(candidate); | 235 channel_->OnCandidate(candidate); |
232 } else { | 236 } else { |
233 pending_candidates_.push_back(candidate); | 237 pending_candidates_.push_back(candidate); |
234 } | 238 } |
235 } | 239 } |
236 | 240 |
237 const std::string& LibjingleTransport::name() const { | 241 const std::string& LibjingleTransport::name() const { |
238 DCHECK(CalledOnValidThread()); | 242 DCHECK(CalledOnValidThread()); |
239 return name_; | 243 return name_; |
240 } | 244 } |
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
414 last_jingle_info_update_time_ = base::TimeTicks::Now(); | 418 last_jingle_info_update_time_ = base::TimeTicks::Now(); |
415 | 419 |
416 while (!on_jingle_info_callbacks_.empty()) { | 420 while (!on_jingle_info_callbacks_.empty()) { |
417 on_jingle_info_callbacks_.begin()->Run(); | 421 on_jingle_info_callbacks_.begin()->Run(); |
418 on_jingle_info_callbacks_.pop_front(); | 422 on_jingle_info_callbacks_.pop_front(); |
419 } | 423 } |
420 } | 424 } |
421 | 425 |
422 } // namespace protocol | 426 } // namespace protocol |
423 } // namespace remoting | 427 } // namespace remoting |
OLD | NEW |