| Index: webrtc/p2p/base/p2ptransportchannel.cc
|
| diff --git a/webrtc/p2p/base/p2ptransportchannel.cc b/webrtc/p2p/base/p2ptransportchannel.cc
|
| index 2801c446461679011e091ccd5fd5af46dcb81cdf..0294f1b41154134e8af990994810aec4b238c7ce 100644
|
| --- a/webrtc/p2p/base/p2ptransportchannel.cc
|
| +++ b/webrtc/p2p/base/p2ptransportchannel.cc
|
| @@ -1209,8 +1209,43 @@ void P2PTransportChannel::SwitchBestConnectionTo(Connection* conn) {
|
| // change, it should be called after all the connection states have changed. For
|
| // example, we call this at the end of SortConnections.
|
| void P2PTransportChannel::UpdateState() {
|
| + TransportChannelState old_state = state_;
|
| state_ = ComputeState();
|
|
|
| + if (old_state != state_) {
|
| + LOG_J(LS_INFO, this) << "Changing TransportChannelState " << old_state
|
| + << " => " << state_;
|
| +
|
| + // Check that the requested transition is allowed. Note that
|
| + // P2PTransportChannel does not (yet) implement a direct mapping of the ICE
|
| + // states from the standard; the difference is covered by
|
| + // TransportController and PeerConnection.
|
| + switch (old_state) {
|
| + case STATE_INIT:
|
| + // TODO(deadbeef): Once we implement end-of-candidates signaling,
|
| + // we shouldn't go from INIT to COMPLETED.
|
| + RTC_DCHECK(state_ == STATE_CONNECTING || state_ == STATE_COMPLETED);
|
| + break;
|
| + case STATE_CONNECTING:
|
| + RTC_DCHECK(state_ == STATE_COMPLETED || state_ == STATE_FAILED);
|
| + break;
|
| + case STATE_COMPLETED:
|
| + // TODO(deadbeef): Once we implement end-of-candidates signaling,
|
| + // we shouldn't go from COMPLETED to CONNECTING.
|
| + // Though we *can* go from COMPlETED to FAILED, if consent expires.
|
| + RTC_DCHECK(state_ == STATE_CONNECTING || state_ == STATE_FAILED);
|
| + break;
|
| + case STATE_FAILED:
|
| + // TODO(deadbeef): Once we implement end-of-candidates signaling,
|
| + // we shouldn't go from FAILED to CONNECTING or COMPLETED.
|
| + RTC_DCHECK(state_ == STATE_CONNECTING || state_ == STATE_COMPLETED);
|
| + break;
|
| + default:
|
| + RTC_DCHECK(false);
|
| + break;
|
| + }
|
| + }
|
| +
|
| bool writable = best_connection_ && best_connection_->writable();
|
| set_writable(writable);
|
|
|
|
|