Remove superfluous constructor from dltsTransport
Addressing TODO left in the code. Bug: none Change-Id: If7ea70c727f6b7f6496cdb0f6d81fb53dd23ef0a Reviewed-on: https://webrtc-review.googlesource.com/c/111748 Reviewed-by: Fredrik Solenberg <solenberg@webrtc.org> Commit-Queue: Harald Alvestrand <hta@webrtc.org> Cr-Commit-Position: refs/heads/master@{#25750}
This commit is contained in:

committed by
Commit Bot

parent
44727b48d6
commit
00dfe932a7
@ -114,31 +114,17 @@ void StreamInterfaceChannel::Close() {
|
||||
state_ = rtc::SS_CLOSED;
|
||||
}
|
||||
|
||||
DtlsTransport::DtlsTransport(IceTransportInternal* ice_transport,
|
||||
const webrtc::CryptoOptions& crypto_options)
|
||||
: transport_name_(ice_transport->transport_name()),
|
||||
component_(ice_transport->component()),
|
||||
ice_transport_(ice_transport),
|
||||
downward_(NULL),
|
||||
srtp_ciphers_(crypto_options.GetSupportedDtlsSrtpCryptoSuites()),
|
||||
ssl_max_version_(rtc::SSL_PROTOCOL_DTLS_12),
|
||||
crypto_options_(crypto_options) {
|
||||
RTC_DCHECK(ice_transport_);
|
||||
ConnectToIceTransport();
|
||||
}
|
||||
|
||||
DtlsTransport::DtlsTransport(
|
||||
std::unique_ptr<IceTransportInternal> ice_transport,
|
||||
const webrtc::CryptoOptions& crypto_options)
|
||||
: transport_name_(ice_transport->transport_name()),
|
||||
component_(ice_transport->component()),
|
||||
ice_transport_(ice_transport.get()),
|
||||
owned_ice_transport_(std::move(ice_transport)),
|
||||
ice_transport_(std::move(ice_transport)),
|
||||
downward_(NULL),
|
||||
srtp_ciphers_(crypto_options.GetSupportedDtlsSrtpCryptoSuites()),
|
||||
ssl_max_version_(rtc::SSL_PROTOCOL_DTLS_12),
|
||||
crypto_options_(crypto_options) {
|
||||
RTC_DCHECK(owned_ice_transport_);
|
||||
RTC_DCHECK(ice_transport_);
|
||||
ConnectToIceTransport();
|
||||
}
|
||||
|
||||
@ -336,7 +322,8 @@ bool DtlsTransport::ExportKeyingMaterial(const std::string& label,
|
||||
|
||||
bool DtlsTransport::SetupDtls() {
|
||||
RTC_DCHECK(dtls_role_);
|
||||
StreamInterfaceChannel* downward = new StreamInterfaceChannel(ice_transport_);
|
||||
StreamInterfaceChannel* downward =
|
||||
new StreamInterfaceChannel(ice_transport_.get());
|
||||
|
||||
dtls_.reset(rtc::SSLStreamAdapter::Create(downward));
|
||||
if (!dtls_) {
|
||||
@ -432,7 +419,7 @@ int DtlsTransport::SendPacket(const char* data,
|
||||
}
|
||||
|
||||
IceTransportInternal* DtlsTransport::ice_transport() {
|
||||
return ice_transport_;
|
||||
return ice_transport_.get();
|
||||
}
|
||||
|
||||
bool DtlsTransport::IsDtlsConnected() {
|
||||
@ -489,7 +476,7 @@ void DtlsTransport::ConnectToIceTransport() {
|
||||
// impl again
|
||||
void DtlsTransport::OnWritableState(rtc::PacketTransportInternal* transport) {
|
||||
RTC_DCHECK_RUN_ON(&thread_checker_);
|
||||
RTC_DCHECK(transport == ice_transport_);
|
||||
RTC_DCHECK(transport == ice_transport_.get());
|
||||
RTC_LOG(LS_VERBOSE) << ToString()
|
||||
<< ": ice_transport writable state changed to "
|
||||
<< ice_transport_->writable();
|
||||
@ -521,7 +508,7 @@ void DtlsTransport::OnWritableState(rtc::PacketTransportInternal* transport) {
|
||||
|
||||
void DtlsTransport::OnReceivingState(rtc::PacketTransportInternal* transport) {
|
||||
RTC_DCHECK_RUN_ON(&thread_checker_);
|
||||
RTC_DCHECK(transport == ice_transport_);
|
||||
RTC_DCHECK(transport == ice_transport_.get());
|
||||
RTC_LOG(LS_VERBOSE) << ToString()
|
||||
<< ": ice_transport "
|
||||
"receiving state changed to "
|
||||
@ -538,7 +525,7 @@ void DtlsTransport::OnReadPacket(rtc::PacketTransportInternal* transport,
|
||||
const int64_t& packet_time_us,
|
||||
int flags) {
|
||||
RTC_DCHECK_RUN_ON(&thread_checker_);
|
||||
RTC_DCHECK(transport == ice_transport_);
|
||||
RTC_DCHECK(transport == ice_transport_.get());
|
||||
RTC_DCHECK(flags == 0);
|
||||
|
||||
if (!dtls_active_) {
|
||||
|
@ -95,9 +95,6 @@ class DtlsTransport : public DtlsTransportInternal {
|
||||
//
|
||||
// |crypto_options| are the options used for the DTLS handshake. This affects
|
||||
// whether GCM crypto suites are negotiated.
|
||||
// TODO(zhihuang): Remove this once we switch to JsepTransportController.
|
||||
explicit DtlsTransport(IceTransportInternal* ice_transport,
|
||||
const webrtc::CryptoOptions& crypto_options);
|
||||
explicit DtlsTransport(std::unique_ptr<IceTransportInternal> ice_transport,
|
||||
const webrtc::CryptoOptions& crypto_options);
|
||||
|
||||
@ -221,9 +218,8 @@ class DtlsTransport : public DtlsTransportInternal {
|
||||
std::string transport_name_;
|
||||
int component_;
|
||||
DtlsTransportState dtls_state_ = DTLS_TRANSPORT_NEW;
|
||||
// Underlying ice_transport, not owned by this class.
|
||||
IceTransportInternal* const ice_transport_;
|
||||
std::unique_ptr<IceTransportInternal> owned_ice_transport_;
|
||||
// Underlying ice_transport, owned by this class.
|
||||
std::unique_ptr<IceTransportInternal> ice_transport_;
|
||||
std::unique_ptr<rtc::SSLStreamAdapter> dtls_; // The DTLS stream
|
||||
StreamInterfaceChannel*
|
||||
downward_; // Wrapper for ice_transport_, owned by dtls_.
|
||||
|
@ -11,6 +11,7 @@
|
||||
#include <algorithm>
|
||||
#include <memory>
|
||||
#include <set>
|
||||
#include <utility>
|
||||
|
||||
#include "p2p/base/dtlstransport.h"
|
||||
#include "p2p/base/fakeicetransport.h"
|
||||
@ -76,18 +77,18 @@ class DtlsTestClient : public sigslot::has_slots<> {
|
||||
}
|
||||
// Set up fake ICE transport and real DTLS transport under test.
|
||||
void SetupTransports(IceRole role, int async_delay_ms = 0) {
|
||||
fake_ice_transport_.reset(new FakeIceTransport("fake", 0));
|
||||
fake_ice_transport_->SetAsync(true);
|
||||
fake_ice_transport_->SetAsyncDelay(async_delay_ms);
|
||||
fake_ice_transport_->SetIceRole(role);
|
||||
fake_ice_transport_->SetIceTiebreaker((role == ICEROLE_CONTROLLING) ? 1
|
||||
: 2);
|
||||
std::unique_ptr<FakeIceTransport> fake_ice_transport;
|
||||
fake_ice_transport.reset(new FakeIceTransport("fake", 0));
|
||||
fake_ice_transport->SetAsync(true);
|
||||
fake_ice_transport->SetAsyncDelay(async_delay_ms);
|
||||
fake_ice_transport->SetIceRole(role);
|
||||
fake_ice_transport->SetIceTiebreaker((role == ICEROLE_CONTROLLING) ? 1 : 2);
|
||||
// Hook the raw packets so that we can verify they are encrypted.
|
||||
fake_ice_transport_->SignalReadPacket.connect(
|
||||
fake_ice_transport->SignalReadPacket.connect(
|
||||
this, &DtlsTestClient::OnFakeIceTransportReadPacket);
|
||||
|
||||
dtls_transport_ = absl::make_unique<DtlsTransport>(
|
||||
fake_ice_transport_.get(), webrtc::CryptoOptions());
|
||||
std::move(fake_ice_transport), webrtc::CryptoOptions());
|
||||
dtls_transport_->SetSslMaxProtocolVersion(ssl_max_version_);
|
||||
// Note: Certificate may be null here if testing passthrough.
|
||||
dtls_transport_->SetLocalCertificate(certificate_);
|
||||
@ -99,13 +100,16 @@ class DtlsTestClient : public sigslot::has_slots<> {
|
||||
this, &DtlsTestClient::OnTransportSentPacket);
|
||||
}
|
||||
|
||||
FakeIceTransport* fake_ice_transport() { return fake_ice_transport_.get(); }
|
||||
FakeIceTransport* fake_ice_transport() {
|
||||
return static_cast<FakeIceTransport*>(dtls_transport_->ice_transport());
|
||||
}
|
||||
|
||||
DtlsTransport* dtls_transport() { return dtls_transport_.get(); }
|
||||
|
||||
// Simulate fake ICE transports connecting.
|
||||
bool Connect(DtlsTestClient* peer, bool asymmetric) {
|
||||
fake_ice_transport_->SetDestination(peer->fake_ice_transport(), asymmetric);
|
||||
fake_ice_transport()->SetDestination(peer->fake_ice_transport(),
|
||||
asymmetric);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user