Index: net/quic/quic_session.cc |
diff --git a/net/quic/quic_session.cc b/net/quic/quic_session.cc |
index b31224392ad8d433d0a2c0f75b3bdcfafd298e6d..7fd5ae9c73217341e85c514be95b31e94174d03d 100644 |
--- a/net/quic/quic_session.cc |
+++ b/net/quic/quic_session.cc |
@@ -476,6 +476,15 @@ bool QuicSession::IsCryptoHandshakeConfirmed() { |
void QuicSession::OnConfigNegotiated() { |
connection_->SetFromConfig(config_); |
QuicVersion version = connection()->version(); |
+ |
+ // A server should accept a small number of additional streams beyond the |
+ // limit sent to the client. This helps avoid early connection termination |
+ // when FIN/RSTs for old streams are lost or arrive out of order. |
+ if (FLAGS_quic_allow_more_open_streams) { |
+ set_max_open_streams((is_server() ? kMaxStreamsMultiplier : 1.0) * |
+ config_.max_streams_per_connection()); |
+ } |
+ |
if (version <= QUIC_VERSION_16) { |
return; |
} |
@@ -564,7 +573,9 @@ void QuicSession::OnCryptoHandshakeEvent(CryptoHandshakeEvent event) { |
// the peer. |
connection_->NeuterUnencryptedPackets(); |
connection_->SetOverallConnectionTimeout(QuicTime::Delta::Infinite()); |
- max_open_streams_ = config_.max_streams_per_connection(); |
+ if (!FLAGS_quic_allow_more_open_streams) { |
+ max_open_streams_ = config_.max_streams_per_connection(); |
+ } |
break; |
default: |
@@ -679,6 +690,11 @@ QuicDataStream* QuicSession::GetIncomingDataStream(QuicStreamId stream_id) { |
return stream; |
} |
+void QuicSession::set_max_open_streams(size_t max_open_streams) { |
+ DVLOG(1) << "Setting max_open_streams_ to " << max_open_streams; |
+ max_open_streams_ = max_open_streams; |
+} |
+ |
bool QuicSession::IsClosedStream(QuicStreamId id) { |
DCHECK_NE(0u, id); |
if (id == kCryptoStreamId) { |