Ignore identical remote fingerprint in DtlsTransportChannelWrapper::SetRemoteFingerprint.

Trying to set the same remote fingerprint could happen during renegotiation and should not fail.

BUG=crbug/362431
R=juberti@webrtc.org

Review URL: https://webrtc-codereview.appspot.com/12449005

git-svn-id: http://webrtc.googlecode.com/svn/trunk@6035 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
jiayl@webrtc.org 2014-05-01 00:00:19 +00:00
parent e44a84d851
commit 53d82350c5
2 changed files with 24 additions and 2 deletions

View File

@ -211,8 +211,11 @@ bool DtlsTransportChannelWrapper::SetRemoteFingerprint(
talk_base::Buffer remote_fingerprint_value(digest, digest_len);
if ((dtls_state_ == STATE_OPEN) &&
(remote_fingerprint_value_ == remote_fingerprint_value)) {
if (dtls_state_ != STATE_NONE &&
remote_fingerprint_value_ == remote_fingerprint_value &&
!digest_alg.empty()) {
// This may happen during renegotiation.
LOG_J(LS_INFO, this) << "Ignoring identical remote DTLS fingerprint";
return true;
}

View File

@ -776,6 +776,25 @@ TEST_F(DtlsTransportChannelTest, TestDtlsReOfferWithDifferentSetupAttr) {
TestTransfer(1, 1000, 100, true);
}
// Test that re-negotiation can be started before the clients become connected
// in the first negotiation.
TEST_F(DtlsTransportChannelTest, TestRenegotiateBeforeConnect) {
MAYBE_SKIP_TEST(HaveDtlsSrtp);
SetChannelCount(2);
PrepareDtls(true, true);
PrepareDtlsSrtp(true, true);
Negotiate();
Renegotiate(&client1_, cricket::CONNECTIONROLE_ACTPASS,
cricket::CONNECTIONROLE_ACTIVE, NF_REOFFER);
bool rv = client1_.Connect(&client2_);
EXPECT_TRUE(rv);
EXPECT_TRUE_WAIT(client1_.writable() && client2_.writable(), 10000);
TestTransfer(0, 1000, 100, true);
TestTransfer(1, 1000, 100, true);
}
// Test Certificates state after negotiation but before connection.
TEST_F(DtlsTransportChannelTest, TestCertificatesBeforeConnect) {
MAYBE_SKIP_TEST(HaveDtls);