| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "net/quic/quic_session.h" | 5 #include "net/quic/quic_session.h" |
| 6 | 6 |
| 7 #include "base/stl_util.h" | 7 #include "base/stl_util.h" |
| 8 #include "base/strings/string_number_conversions.h" | 8 #include "base/strings/string_number_conversions.h" |
| 9 #include "base/strings/stringprintf.h" | 9 #include "base/strings/stringprintf.h" |
| 10 #include "net/quic/crypto/proof_verifier.h" | 10 #include "net/quic/crypto/proof_verifier.h" |
| (...skipping 657 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 668 return nullptr; | 668 return nullptr; |
| 669 } | 669 } |
| 670 | 670 |
| 671 available_streams_.erase(stream_id); | 671 available_streams_.erase(stream_id); |
| 672 | 672 |
| 673 if (!MaybeIncreaseLargestPeerStreamId(stream_id)) { | 673 if (!MaybeIncreaseLargestPeerStreamId(stream_id)) { |
| 674 return nullptr; | 674 return nullptr; |
| 675 } | 675 } |
| 676 // Check if the new number of open streams would cause the number of | 676 // Check if the new number of open streams would cause the number of |
| 677 // open streams to exceed the limit. | 677 // open streams to exceed the limit. |
| 678 size_t num_open_incoming_streams = | 678 if (GetNumOpenIncomingStreams() >= max_open_incoming_streams()) { |
| 679 FLAGS_quic_distinguish_incoming_outgoing_streams | |
| 680 ? GetNumOpenIncomingStreams() | |
| 681 : dynamic_stream_map_.size() - draining_streams_.size() + | |
| 682 locally_closed_streams_highest_offset_.size(); | |
| 683 if (num_open_incoming_streams >= max_open_incoming_streams()) { | |
| 684 if (connection()->version() <= QUIC_VERSION_27) { | 679 if (connection()->version() <= QUIC_VERSION_27) { |
| 685 connection()->SendConnectionCloseWithDetails( | 680 connection()->SendConnectionCloseWithDetails( |
| 686 QUIC_TOO_MANY_OPEN_STREAMS, "Old style stream rejection"); | 681 QUIC_TOO_MANY_OPEN_STREAMS, "Old style stream rejection"); |
| 687 } else { | 682 } else { |
| 688 // Refuse to open the stream. | 683 // Refuse to open the stream. |
| 689 SendRstStream(stream_id, QUIC_REFUSED_STREAM, 0); | 684 SendRstStream(stream_id, QUIC_REFUSED_STREAM, 0); |
| 690 } | 685 } |
| 691 return nullptr; | 686 return nullptr; |
| 692 } | 687 } |
| 693 | 688 |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 812 | 807 |
| 813 size_t QuicSession::MaxAvailableStreams() const { | 808 size_t QuicSession::MaxAvailableStreams() const { |
| 814 return max_open_incoming_streams_ * kMaxAvailableStreamsMultiplier; | 809 return max_open_incoming_streams_ * kMaxAvailableStreamsMultiplier; |
| 815 } | 810 } |
| 816 | 811 |
| 817 bool QuicSession::IsIncomingStream(QuicStreamId id) const { | 812 bool QuicSession::IsIncomingStream(QuicStreamId id) const { |
| 818 return id % 2 != next_outgoing_stream_id_ % 2; | 813 return id % 2 != next_outgoing_stream_id_ % 2; |
| 819 } | 814 } |
| 820 | 815 |
| 821 } // namespace net | 816 } // namespace net |
| OLD | NEW |