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

Unified Diff: webrtc/p2p/base/dtlstransportchannel.cc

Issue 1414363002: Exposing DTLS transport state from TransportChannel. (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Renaming, fixing comment. Created 5 years, 2 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | webrtc/p2p/base/transport.h » ('j') | webrtc/p2p/base/transportchannel.h » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/p2p/base/dtlstransportchannel.cc
diff --git a/webrtc/p2p/base/dtlstransportchannel.cc b/webrtc/p2p/base/dtlstransportchannel.cc
index 148a19108d4149ea76ba9680375037ebb398aae9..51bfb6706f4a83b4ee4ceefb91c0346f3806d395 100644
--- a/webrtc/p2p/base/dtlstransportchannel.cc
+++ b/webrtc/p2p/base/dtlstransportchannel.cc
@@ -230,6 +230,7 @@ bool DtlsTransportChannelWrapper::SetRemoteFingerprint(
if (!SetupDtls()) {
dtls_state_ = STATE_CLOSED;
+ set_dtls_transport_state(DTLS_TRANSPORT_FAILED);
return false;
}
@@ -239,8 +240,9 @@ bool DtlsTransportChannelWrapper::SetRemoteFingerprint(
bool DtlsTransportChannelWrapper::GetRemoteSSLCertificate(
rtc::SSLCertificate** cert) const {
- if (!dtls_)
+ if (!dtls_) {
return false;
+ }
return dtls_->GetPeerCertificate(cert);
}
@@ -286,8 +288,9 @@ bool DtlsTransportChannelWrapper::SetupDtls() {
bool DtlsTransportChannelWrapper::SetSrtpCiphers(
const std::vector<std::string>& ciphers) {
- if (srtp_ciphers_ == ciphers)
+ if (srtp_ciphers_ == ciphers) {
return true;
+ }
if (dtls_state_ == STATE_STARTED) {
LOG(LS_WARNING) << "Ignoring new SRTP ciphers while DTLS is negotiating";
@@ -538,6 +541,7 @@ void DtlsTransportChannelWrapper::OnDtlsEvent(rtc::StreamInterface* dtls,
// sure we don't accidentally frob the state if it's closed.
dtls_state_ = STATE_OPEN;
set_writable(true);
+ set_dtls_transport_state(DTLS_TRANSPORT_CONNECTED);
}
}
if (sig & rtc::SE_READ) {
@@ -556,6 +560,8 @@ void DtlsTransportChannelWrapper::OnDtlsEvent(rtc::StreamInterface* dtls,
}
set_writable(false);
dtls_state_ = STATE_CLOSED;
+ set_dtls_transport_state(err ? DTLS_TRANSPORT_FAILED
+ : DTLS_TRANSPORT_CLOSED);
}
}
@@ -564,12 +570,14 @@ bool DtlsTransportChannelWrapper::MaybeStartDtls() {
if (dtls_->StartSSLWithPeer()) {
LOG_J(LS_ERROR, this) << "Couldn't start DTLS handshake";
dtls_state_ = STATE_CLOSED;
+ set_dtls_transport_state(DTLS_TRANSPORT_FAILED);
return false;
}
LOG_J(LS_INFO, this)
<< "DtlsTransportChannelWrapper: Started DTLS handshake";
dtls_state_ = STATE_STARTED;
+ set_dtls_transport_state(DTLS_TRANSPORT_CONNECTING);
pthatcher1 2015/10/20 20:28:06 Please see if we can reduce down to one dtls_state
Taylor Brandstetter 2015/10/21 16:28:16 Done.
}
return true;
}
« no previous file with comments | « no previous file | webrtc/p2p/base/transport.h » ('j') | webrtc/p2p/base/transportchannel.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698