Fix ICE connection in datagram_transport.

Connect ICE state changes to datagram transport regardless of bypass mode.

ICE states were connected to datagram transport only in bypass mode. As a result, if we received datagram state change notification before ICE state change notification, the state was not propagated.

TODO: We need fake datagram transport implementation/test so that we could unit test such failures without relying on downstream projects.

Bug: webrtc:9719
Change-Id: I5a180676e0d05f707b2a43d07e8c04fb10985027
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/138982
Reviewed-by: Steve Anton <steveanton@webrtc.org>
Reviewed-by: Bjorn Mellem <mellem@webrtc.org>
Commit-Queue: Anton Sukhanov <sukhanov@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#28094}
This commit is contained in:
Anton Sukhanov 2019-05-28 15:29:45 -07:00 committed by Commit Bot
parent 44bd71cc44
commit 686be20b45

View File

@ -58,6 +58,17 @@ DatagramDtlsAdaptor::DatagramDtlsAdaptor(
}
void DatagramDtlsAdaptor::ConnectToIceTransport() {
ice_transport_->SignalWritableState.connect(
this, &DatagramDtlsAdaptor::OnWritableState);
ice_transport_->SignalReadyToSend.connect(
this, &DatagramDtlsAdaptor::OnReadyToSend);
ice_transport_->SignalReceivingState.connect(
this, &DatagramDtlsAdaptor::OnReceivingState);
// Datagram transport does not propagate network route change.
ice_transport_->SignalNetworkRouteChanged.connect(
this, &DatagramDtlsAdaptor::OnNetworkRouteChanged);
if (kBypassDatagramDtlsTestOnly) {
// In bypass mode we have to subscribe to ICE read and sent events.
// Test only case to use ICE directly instead of data transport.
@ -66,21 +77,10 @@ void DatagramDtlsAdaptor::ConnectToIceTransport() {
ice_transport_->SignalSentPacket.connect(
this, &DatagramDtlsAdaptor::OnSentPacket);
ice_transport_->SignalWritableState.connect(
this, &DatagramDtlsAdaptor::OnWritableState);
ice_transport_->SignalReadyToSend.connect(
this, &DatagramDtlsAdaptor::OnReadyToSend);
ice_transport_->SignalReceivingState.connect(
this, &DatagramDtlsAdaptor::OnReceivingState);
} else {
// Subscribe to Data Transport read packets.
datagram_transport_->SetDatagramSink(this);
datagram_transport_->SetTransportStateCallback(this);
// Datagram transport does not propagate network route change.
ice_transport_->SignalNetworkRouteChanged.connect(
this, &DatagramDtlsAdaptor::OnNetworkRouteChanged);
}
}