Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(510)

Side by Side Diff: webrtc/p2p/base/transportcontroller.cc

Issue 2681403002: Merge to M57: Only set certificate on DTLS transport if fingerprint is found in SDP. (Closed)
Patch Set: Changing upstream branch to m57 Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « webrtc/p2p/base/jseptransport.cc ('k') | webrtc/p2p/base/transportdescriptionfactory.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 TransportChannelImpl* dtls = 259 TransportChannelImpl* dtls =
260 CreateDtlsTransportChannel_n(transport_name, component, ice); 260 CreateDtlsTransportChannel_n(transport_name, component, ice);
261 dtls->SetMetricsObserver(metrics_observer_); 261 dtls->SetMetricsObserver(metrics_observer_);
262 dtls->SetIceRole(ice_role_); 262 dtls->SetIceRole(ice_role_);
263 dtls->SetIceTiebreaker(ice_tiebreaker_); 263 dtls->SetIceTiebreaker(ice_tiebreaker_);
264 dtls->SetIceConfig(ice_config_); 264 dtls->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->SignalGatheringState.connect( 273 dtls->SignalGatheringState.connect(
278 this, &TransportController::OnChannelGatheringState_n); 274 this, &TransportController::OnChannelGatheringState_n);
(...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after
523 bool TransportController::SetLocalCertificate_n( 519 bool TransportController::SetLocalCertificate_n(
524 const rtc::scoped_refptr<rtc::RTCCertificate>& certificate) { 520 const rtc::scoped_refptr<rtc::RTCCertificate>& certificate) {
525 RTC_DCHECK(network_thread_->IsCurrent()); 521 RTC_DCHECK(network_thread_->IsCurrent());
526 522
527 // Can't change a certificate, or set a null certificate. 523 // Can't change a certificate, or set a null certificate.
528 if (certificate_ || !certificate) { 524 if (certificate_ || !certificate) {
529 return false; 525 return false;
530 } 526 }
531 certificate_ = certificate; 527 certificate_ = certificate;
532 528
533 // Set certificate both for Transport, which verifies it matches the 529 // Set certificate for JsepTransport, which verifies it matches the
534 // fingerprint in SDP... 530 // fingerprint in SDP, and only applies it to the DTLS transport if a
531 // fingerprint attribute is present in SDP. This is used for fallback from
532 // DTLS to SDES.
535 for (auto& kv : transports_) { 533 for (auto& kv : transports_) {
536 kv.second->SetLocalCertificate(certificate_); 534 kv.second->SetLocalCertificate(certificate_);
537 } 535 }
538 // ... and for the DTLS channel, which needs it for the DTLS handshake.
539 for (auto& channel : channels_) {
540 bool set_cert_success = channel->dtls()->SetLocalCertificate(certificate);
541 RTC_DCHECK(set_cert_success);
542 }
543 return true; 536 return true;
544 } 537 }
545 538
546 bool TransportController::GetLocalCertificate_n( 539 bool TransportController::GetLocalCertificate_n(
547 const std::string& transport_name, 540 const std::string& transport_name,
548 rtc::scoped_refptr<rtc::RTCCertificate>* certificate) const { 541 rtc::scoped_refptr<rtc::RTCCertificate>* certificate) const {
549 RTC_DCHECK(network_thread_->IsCurrent()); 542 RTC_DCHECK(network_thread_->IsCurrent());
550 543
551 const JsepTransport* t = GetJsepTransport(transport_name); 544 const JsepTransport* t = GetJsepTransport(transport_name);
552 if (!t) { 545 if (!t) {
(...skipping 321 matching lines...) Expand 10 before | Expand all | Expand 10 after
874 RTC_FROM_HERE, this, MSG_ICEGATHERINGSTATE, 867 RTC_FROM_HERE, this, MSG_ICEGATHERINGSTATE,
875 new rtc::TypedMessageData<IceGatheringState>(new_gathering_state)); 868 new rtc::TypedMessageData<IceGatheringState>(new_gathering_state));
876 } 869 }
877 } 870 }
878 871
879 void TransportController::OnDtlsHandshakeError(rtc::SSLHandshakeError error) { 872 void TransportController::OnDtlsHandshakeError(rtc::SSLHandshakeError error) {
880 SignalDtlsHandshakeError(error); 873 SignalDtlsHandshakeError(error);
881 } 874 }
882 875
883 } // namespace cricket 876 } // namespace cricket
OLDNEW
« no previous file with comments | « webrtc/p2p/base/jseptransport.cc ('k') | webrtc/p2p/base/transportdescriptionfactory.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698