| Index: webrtc/p2p/base/dtlstransportchannel.cc
|
| diff --git a/webrtc/p2p/base/dtlstransportchannel.cc b/webrtc/p2p/base/dtlstransportchannel.cc
|
| index dcebdee53e48828842b0d8929a2a780e77c69311..3474237269bcf0a74a347781a800599f64aab029 100644
|
| --- a/webrtc/p2p/base/dtlstransportchannel.cc
|
| +++ b/webrtc/p2p/base/dtlstransportchannel.cc
|
| @@ -97,6 +97,8 @@
|
| dtls_state_(STATE_NONE),
|
| ssl_role_(rtc::SSL_CLIENT),
|
| ssl_max_version_(rtc::SSL_PROTOCOL_DTLS_10) {
|
| + channel_->SignalReadableState.connect(this,
|
| + &DtlsTransportChannelWrapper::OnReadableState);
|
| channel_->SignalWritableState.connect(this,
|
| &DtlsTransportChannelWrapper::OnWritableState);
|
| channel_->SignalReadPacket.connect(this,
|
| @@ -390,12 +392,25 @@
|
| // (1) If we're not doing DTLS-SRTP, then the state is just the
|
| // state of the underlying impl()
|
| // (2) If we're doing DTLS-SRTP:
|
| -// - Prior to the DTLS handshake, the state is neither receiving nor
|
| +// - Prior to the DTLS handshake, the state is neither readable or
|
| // writable
|
| // - When the impl goes writable for the first time we
|
| // start the DTLS handshake
|
| // - Once the DTLS handshake completes, the state is that of the
|
| // impl again
|
| +void DtlsTransportChannelWrapper::OnReadableState(TransportChannel* channel) {
|
| + ASSERT(rtc::Thread::Current() == worker_thread_);
|
| + ASSERT(channel == channel_);
|
| + LOG_J(LS_VERBOSE, this)
|
| + << "DTLSTransportChannelWrapper: channel readable state changed to "
|
| + << channel_->readable();
|
| +
|
| + if (dtls_state_ == STATE_NONE || dtls_state_ == STATE_OPEN) {
|
| + set_readable(channel_->readable());
|
| + // Note: SignalReadableState fired by set_readable.
|
| + }
|
| +}
|
| +
|
| void DtlsTransportChannelWrapper::OnWritableState(TransportChannel* channel) {
|
| ASSERT(rtc::Thread::Current() == worker_thread_);
|
| ASSERT(channel == channel_);
|
| @@ -530,6 +545,8 @@
|
| // The check for OPEN shouldn't be necessary but let's make
|
| // sure we don't accidentally frob the state if it's closed.
|
| dtls_state_ = STATE_OPEN;
|
| +
|
| + set_readable(true);
|
| set_writable(true);
|
| }
|
| }
|
| @@ -547,6 +564,8 @@
|
| } else {
|
| LOG_J(LS_INFO, this) << "DTLS channel error, code=" << err;
|
| }
|
| +
|
| + set_readable(false);
|
| set_writable(false);
|
| dtls_state_ = STATE_CLOSED;
|
| }
|
|
|