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 683 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
694 } | 694 } |
695 | 695 |
696 available_streams_.erase(stream_id); | 696 available_streams_.erase(stream_id); |
697 | 697 |
698 if (!MaybeIncreaseLargestPeerStreamId(stream_id)) { | 698 if (!MaybeIncreaseLargestPeerStreamId(stream_id)) { |
699 return nullptr; | 699 return nullptr; |
700 } | 700 } |
701 // Check if the new number of open streams would cause the number of | 701 // Check if the new number of open streams would cause the number of |
702 // open streams to exceed the limit. | 702 // open streams to exceed the limit. |
703 if (GetNumOpenIncomingStreams() >= max_open_incoming_streams()) { | 703 if (GetNumOpenIncomingStreams() >= max_open_incoming_streams()) { |
704 if (connection()->version() <= QUIC_VERSION_27) { | 704 // Refuse to open the stream. |
705 connection()->CloseConnection( | 705 SendRstStream(stream_id, QUIC_REFUSED_STREAM, 0); |
706 QUIC_TOO_MANY_OPEN_STREAMS, "Old style stream rejection", | |
707 ConnectionCloseBehavior::SEND_CONNECTION_CLOSE_PACKET); | |
708 } else { | |
709 // Refuse to open the stream. | |
710 SendRstStream(stream_id, QUIC_REFUSED_STREAM, 0); | |
711 } | |
712 return nullptr; | 706 return nullptr; |
713 } | 707 } |
714 | 708 |
715 return CreateIncomingDynamicStream(stream_id); | 709 return CreateIncomingDynamicStream(stream_id); |
716 } | 710 } |
717 | 711 |
718 void QuicSession::set_max_open_incoming_streams( | 712 void QuicSession::set_max_open_incoming_streams( |
719 size_t max_open_incoming_streams) { | 713 size_t max_open_incoming_streams) { |
720 DVLOG(1) << "Setting max_open_incoming_streams_ to " | 714 DVLOG(1) << "Setting max_open_incoming_streams_ to " |
721 << max_open_incoming_streams; | 715 << max_open_incoming_streams; |
(...skipping 111 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
833 | 827 |
834 size_t QuicSession::MaxAvailableStreams() const { | 828 size_t QuicSession::MaxAvailableStreams() const { |
835 return max_open_incoming_streams_ * kMaxAvailableStreamsMultiplier; | 829 return max_open_incoming_streams_ * kMaxAvailableStreamsMultiplier; |
836 } | 830 } |
837 | 831 |
838 bool QuicSession::IsIncomingStream(QuicStreamId id) const { | 832 bool QuicSession::IsIncomingStream(QuicStreamId id) const { |
839 return id % 2 != next_outgoing_stream_id_ % 2; | 833 return id % 2 != next_outgoing_stream_id_ % 2; |
840 } | 834 } |
841 | 835 |
842 } // namespace net | 836 } // namespace net |
OLD | NEW |