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 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
250 CreateIceTransportChannel_n(transport_name, component); | 250 CreateIceTransportChannel_n(transport_name, component); |
251 // TODO(deadbeef): To support QUIC, would need to create a | 251 // TODO(deadbeef): To support QUIC, would need to create a |
252 // QuicTransportChannel here. What is "dtls" in this file would then become | 252 // QuicTransportChannel here. What is "dtls" in this file would then become |
253 // "dtls or quic". | 253 // "dtls or quic". |
254 DtlsTransportInternal* dtls = | 254 DtlsTransportInternal* dtls = |
255 CreateDtlsTransportChannel_n(transport_name, component, ice); | 255 CreateDtlsTransportChannel_n(transport_name, component, ice); |
256 dtls->ice_transport()->SetMetricsObserver(metrics_observer_); | 256 dtls->ice_transport()->SetMetricsObserver(metrics_observer_); |
257 dtls->ice_transport()->SetIceRole(ice_role_); | 257 dtls->ice_transport()->SetIceRole(ice_role_); |
258 dtls->ice_transport()->SetIceTiebreaker(ice_tiebreaker_); | 258 dtls->ice_transport()->SetIceTiebreaker(ice_tiebreaker_); |
259 dtls->ice_transport()->SetIceConfig(ice_config_); | 259 dtls->ice_transport()->SetIceConfig(ice_config_); |
| 260 if (certificate_) { |
| 261 bool set_cert_success = dtls->SetLocalCertificate(certificate_); |
| 262 RTC_DCHECK(set_cert_success); |
| 263 } |
260 | 264 |
261 // Connect to signals offered by the channels. Currently, the DTLS channel | 265 // Connect to signals offered by the channels. Currently, the DTLS channel |
262 // forwards signals from the ICE channel, so we only need to connect to the | 266 // forwards signals from the ICE channel, so we only need to connect to the |
263 // DTLS channel. In the future this won't be the case. | 267 // DTLS channel. In the future this won't be the case. |
264 dtls->SignalWritableState.connect( | 268 dtls->SignalWritableState.connect( |
265 this, &TransportController::OnChannelWritableState_n); | 269 this, &TransportController::OnChannelWritableState_n); |
266 dtls->SignalReceivingState.connect( | 270 dtls->SignalReceivingState.connect( |
267 this, &TransportController::OnChannelReceivingState_n); | 271 this, &TransportController::OnChannelReceivingState_n); |
268 dtls->SignalDtlsHandshakeError.connect( | 272 dtls->SignalDtlsHandshakeError.connect( |
269 this, &TransportController::OnDtlsHandshakeError); | 273 this, &TransportController::OnDtlsHandshakeError); |
(...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
528 const rtc::scoped_refptr<rtc::RTCCertificate>& certificate) { | 532 const rtc::scoped_refptr<rtc::RTCCertificate>& certificate) { |
529 RTC_DCHECK(network_thread_->IsCurrent()); | 533 RTC_DCHECK(network_thread_->IsCurrent()); |
530 | 534 |
531 // Can't change a certificate, or set a null certificate. | 535 // Can't change a certificate, or set a null certificate. |
532 if (certificate_ || !certificate) { | 536 if (certificate_ || !certificate) { |
533 return false; | 537 return false; |
534 } | 538 } |
535 certificate_ = certificate; | 539 certificate_ = certificate; |
536 | 540 |
537 // Set certificate for JsepTransport, which verifies it matches the | 541 // Set certificate for JsepTransport, which verifies it matches the |
538 // fingerprint in SDP, and only applies it to the DTLS transport if a | 542 // fingerprint in SDP, and DTLS transport. |
539 // fingerprint attribute is present in SDP. This is used for fallback from | 543 // Fallback from DTLS to SDES is not supported. |
540 // DTLS to SDES. | |
541 for (auto& kv : transports_) { | 544 for (auto& kv : transports_) { |
542 kv.second->SetLocalCertificate(certificate_); | 545 kv.second->SetLocalCertificate(certificate_); |
543 } | 546 } |
| 547 for (auto& channel : channels_) { |
| 548 bool set_cert_success = channel->dtls()->SetLocalCertificate(certificate_); |
| 549 RTC_DCHECK(set_cert_success); |
| 550 } |
544 return true; | 551 return true; |
545 } | 552 } |
546 | 553 |
547 bool TransportController::GetLocalCertificate_n( | 554 bool TransportController::GetLocalCertificate_n( |
548 const std::string& transport_name, | 555 const std::string& transport_name, |
549 rtc::scoped_refptr<rtc::RTCCertificate>* certificate) const { | 556 rtc::scoped_refptr<rtc::RTCCertificate>* certificate) const { |
550 RTC_DCHECK(network_thread_->IsCurrent()); | 557 RTC_DCHECK(network_thread_->IsCurrent()); |
551 | 558 |
552 const JsepTransport* t = GetJsepTransport(transport_name); | 559 const JsepTransport* t = GetJsepTransport(transport_name); |
553 if (!t) { | 560 if (!t) { |
(...skipping 328 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
882 RTC_FROM_HERE, this, MSG_ICEGATHERINGSTATE, | 889 RTC_FROM_HERE, this, MSG_ICEGATHERINGSTATE, |
883 new rtc::TypedMessageData<IceGatheringState>(new_gathering_state)); | 890 new rtc::TypedMessageData<IceGatheringState>(new_gathering_state)); |
884 } | 891 } |
885 } | 892 } |
886 | 893 |
887 void TransportController::OnDtlsHandshakeError(rtc::SSLHandshakeError error) { | 894 void TransportController::OnDtlsHandshakeError(rtc::SSLHandshakeError error) { |
888 SignalDtlsHandshakeError(error); | 895 SignalDtlsHandshakeError(error); |
889 } | 896 } |
890 | 897 |
891 } // namespace cricket | 898 } // namespace cricket |
OLD | NEW |