Change initial DTLS retransmission timer from 1 second to 50ms.

This will help ensure a timely DTLS handshake when there's packet
loss. It will likely result in spurious retransmissions (since the
RTT is usually > 50ms), but since exponential backoff is still used,
there will at most be ~4 extra retransmissions. For a time-sensitive
application like WebRTC this seems like a reasonable tradeoff.

R=juberti@chromium.org, juberti@webrtc.org, pthatcher@webrtc.org

Review URL: https://codereview.webrtc.org/1981463002 .

Cr-Commit-Position: refs/heads/master@{#12853}
This commit is contained in:
Taylor Brandstetter 2016-05-23 12:48:50 -07:00
parent da2ba4dcba
commit 1e43562836

View File

@ -771,13 +771,19 @@ int OpenSSLStreamAdapter::BeginSSL() {
SSL_set_app_data(ssl_, this);
SSL_set_bio(ssl_, bio, bio); // the SSL object owns the bio now.
#ifndef OPENSSL_IS_BORINGSSL
if (ssl_mode_ == SSL_MODE_DTLS) {
#ifdef OPENSSL_IS_BORINGSSL
// Change the initial retransmission timer from 1 second to 50ms.
// This will likely result in some spurious retransmissions, but
// it's useful for ensuring a timely handshake when there's packet
// loss.
DTLSv1_set_initial_timeout_duration(ssl_, 50);
#else
// Enable read-ahead for DTLS so whole packets are read from internal BIO
// before parsing. This is done internally by BoringSSL for DTLS.
SSL_set_read_ahead(ssl_, 1);
}
#endif
}
SSL_set_mode(ssl_, SSL_MODE_ENABLE_PARTIAL_WRITE |
SSL_MODE_ACCEPT_MOVING_WRITE_BUFFER);