Index: net/quic/quic_session.cc |
diff --git a/net/quic/quic_session.cc b/net/quic/quic_session.cc |
index 77eaa52057ea2af35bc364a620d56ad955cefced..42c05b612a239786888cdb06469ba2d2e045ed60 100644 |
--- a/net/quic/quic_session.cc |
+++ b/net/quic/quic_session.cc |
@@ -16,6 +16,7 @@ using base::StringPiece; |
using base::hash_map; |
using base::hash_set; |
using std::make_pair; |
+using std::max; |
using std::vector; |
namespace net { |
@@ -471,12 +472,19 @@ 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_.MaxStreamsPerConnection()); |
+ uint32 max_streams = config_.MaxStreamsPerConnection(); |
+ if (is_server()) { |
+ // 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. |
+ // Use a minimum number of additional streams, or a percentage increase, |
+ // whichever is larger. |
+ max_streams = |
+ max(max_streams + kMaxStreamsMinimumIncrement, |
+ static_cast<uint32>(max_streams * kMaxStreamsMultiplier)); |
+ } |
+ set_max_open_streams(max_streams); |
} |
if (version <= QUIC_VERSION_16) { |