| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2015 The WebRTC Project Authors. All rights reserved. | 2 * Copyright 2015 The WebRTC Project Authors. All rights reserved. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
| 5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
| 6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
| 7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
| 8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
| 9 */ | 9 */ |
| 10 | 10 |
| (...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 220 rtc::Bind(&TransportController::GetStats_n, this, transport_name, stats)); | 220 rtc::Bind(&TransportController::GetStats_n, this, transport_name, stats)); |
| 221 } | 221 } |
| 222 | 222 |
| 223 void TransportController::SetMetricsObserver( | 223 void TransportController::SetMetricsObserver( |
| 224 webrtc::MetricsObserverInterface* metrics_observer) { | 224 webrtc::MetricsObserverInterface* metrics_observer) { |
| 225 return network_thread_->Invoke<void>( | 225 return network_thread_->Invoke<void>( |
| 226 RTC_FROM_HERE, rtc::Bind(&TransportController::SetMetricsObserver_n, this, | 226 RTC_FROM_HERE, rtc::Bind(&TransportController::SetMetricsObserver_n, this, |
| 227 metrics_observer)); | 227 metrics_observer)); |
| 228 } | 228 } |
| 229 | 229 |
| 230 TransportChannel* TransportController::CreateTransportChannel( |
| 231 const std::string& transport_name, |
| 232 int component) { |
| 233 return network_thread_->Invoke<TransportChannel*>( |
| 234 RTC_FROM_HERE, rtc::Bind(&TransportController::CreateTransportChannel_n, |
| 235 this, transport_name, component)); |
| 236 } |
| 237 |
| 230 TransportChannel* TransportController::CreateTransportChannel_n( | 238 TransportChannel* TransportController::CreateTransportChannel_n( |
| 231 const std::string& transport_name, | 239 const std::string& transport_name, |
| 232 int component) { | 240 int component) { |
| 233 RTC_DCHECK(network_thread_->IsCurrent()); | 241 RTC_DCHECK(network_thread_->IsCurrent()); |
| 234 | 242 |
| 235 RefCountedChannel* existing_channel = GetChannel_n(transport_name, component); | 243 RefCountedChannel* existing_channel = GetChannel_n(transport_name, component); |
| 236 if (existing_channel) { | 244 if (existing_channel) { |
| 237 // Channel already exists; increment reference count and return. | 245 // Channel already exists; increment reference count and return. |
| 238 existing_channel->AddRef(); | 246 existing_channel->AddRef(); |
| 239 return existing_channel->dtls(); | 247 return existing_channel->dtls(); |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 285 RTC_DCHECK(channel_added); | 293 RTC_DCHECK(channel_added); |
| 286 // Adding a channel could cause aggregate state to change. | 294 // Adding a channel could cause aggregate state to change. |
| 287 UpdateAggregateStates_n(); | 295 UpdateAggregateStates_n(); |
| 288 return dtls; | 296 return dtls; |
| 289 } | 297 } |
| 290 | 298 |
| 291 void TransportController::DestroyTransportChannel_n( | 299 void TransportController::DestroyTransportChannel_n( |
| 292 const std::string& transport_name, | 300 const std::string& transport_name, |
| 293 int component) { | 301 int component) { |
| 294 RTC_DCHECK(network_thread_->IsCurrent()); | 302 RTC_DCHECK(network_thread_->IsCurrent()); |
| 295 | |
| 296 auto it = GetChannelIterator_n(transport_name, component); | 303 auto it = GetChannelIterator_n(transport_name, component); |
| 297 if (it == channels_.end()) { | 304 if (it == channels_.end()) { |
| 298 LOG(LS_WARNING) << "Attempting to delete " << transport_name | 305 LOG(LS_WARNING) << "Attempting to delete " << transport_name |
| 299 << " TransportChannel " << component | 306 << " TransportChannel " << component |
| 300 << ", which doesn't exist."; | 307 << ", which doesn't exist."; |
| 301 return; | 308 return; |
| 302 } | 309 } |
| 303 if ((*it)->Release() > 0) { | 310 if ((*it)->Release() > 0) { |
| 304 return; | 311 return; |
| 305 } | 312 } |
| 306 channels_.erase(it); | 313 channels_.erase(it); |
| 307 | 314 |
| 308 JsepTransport* t = GetJsepTransport(transport_name); | 315 JsepTransport* t = GetJsepTransport(transport_name); |
| 309 bool channel_removed = t->RemoveChannel(component); | 316 bool channel_removed = t->RemoveChannel(component); |
| 310 RTC_DCHECK(channel_removed); | 317 RTC_DCHECK(channel_removed); |
| 311 // Just as we create a Transport when its first channel is created, | 318 // Just as we create a Transport when its first channel is created, |
| 312 // we delete it when its last channel is deleted. | 319 // we delete it when its last channel is deleted. |
| 313 if (!t->HasChannels()) { | 320 if (!t->HasChannels()) { |
| 314 transports_.erase(transport_name); | 321 transports_.erase(transport_name); |
| 315 } | 322 } |
| 316 | |
| 317 // Removing a channel could cause aggregate state to change. | 323 // Removing a channel could cause aggregate state to change. |
| 318 UpdateAggregateStates_n(); | 324 UpdateAggregateStates_n(); |
| 319 } | 325 } |
| 320 | 326 |
| 321 std::vector<std::string> TransportController::transport_names_for_testing() { | 327 std::vector<std::string> TransportController::transport_names_for_testing() { |
| 322 std::vector<std::string> ret; | 328 std::vector<std::string> ret; |
| 323 for (const auto& kv : transports_) { | 329 for (const auto& kv : transports_) { |
| 324 ret.push_back(kv.first); | 330 ret.push_back(kv.first); |
| 325 } | 331 } |
| 326 return ret; | 332 return ret; |
| (...skipping 542 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 869 RTC_FROM_HERE, this, MSG_ICEGATHERINGSTATE, | 875 RTC_FROM_HERE, this, MSG_ICEGATHERINGSTATE, |
| 870 new rtc::TypedMessageData<IceGatheringState>(new_gathering_state)); | 876 new rtc::TypedMessageData<IceGatheringState>(new_gathering_state)); |
| 871 } | 877 } |
| 872 } | 878 } |
| 873 | 879 |
| 874 void TransportController::OnDtlsHandshakeError(rtc::SSLHandshakeError error) { | 880 void TransportController::OnDtlsHandshakeError(rtc::SSLHandshakeError error) { |
| 875 SignalDtlsHandshakeError(error); | 881 SignalDtlsHandshakeError(error); |
| 876 } | 882 } |
| 877 | 883 |
| 878 } // namespace cricket | 884 } // namespace cricket |
| OLD | NEW |