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