| 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/core/quic_session.h" | 5 #include "net/quic/core/quic_session.h" |
| 6 | 6 |
| 7 #include "base/memory/ptr_util.h" | 7 #include "base/memory/ptr_util.h" |
| 8 #include "base/stl_util.h" | 8 #include "base/stl_util.h" |
| 9 #include "base/strings/string_number_conversions.h" | 9 #include "base/strings/string_number_conversions.h" |
| 10 #include "net/quic/core/crypto/proof_verifier.h" | 10 #include "net/quic/core/crypto/proof_verifier.h" |
| (...skipping 658 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 669 (stream_id - largest_peer_created_stream_id_) / 2 - 1; | 669 (stream_id - largest_peer_created_stream_id_) / 2 - 1; |
| 670 size_t new_num_available_streams = | 670 size_t new_num_available_streams = |
| 671 GetNumAvailableStreams() + additional_available_streams; | 671 GetNumAvailableStreams() + additional_available_streams; |
| 672 if (new_num_available_streams > MaxAvailableStreams()) { | 672 if (new_num_available_streams > MaxAvailableStreams()) { |
| 673 DVLOG(1) << ENDPOINT | 673 DVLOG(1) << ENDPOINT |
| 674 << "Failed to create a new incoming stream with id:" << stream_id | 674 << "Failed to create a new incoming stream with id:" << stream_id |
| 675 << ". There are already " << GetNumAvailableStreams() | 675 << ". There are already " << GetNumAvailableStreams() |
| 676 << " streams available, which would become " | 676 << " streams available, which would become " |
| 677 << new_num_available_streams << ", which exceeds the limit " | 677 << new_num_available_streams << ", which exceeds the limit " |
| 678 << MaxAvailableStreams() << "."; | 678 << MaxAvailableStreams() << "."; |
| 679 string details = IntToString(new_num_available_streams) + " above " + | |
| 680 IntToString(MaxAvailableStreams()); | |
| 681 connection()->CloseConnection( | 679 connection()->CloseConnection( |
| 682 QUIC_TOO_MANY_AVAILABLE_STREAMS, details.c_str(), | 680 QUIC_TOO_MANY_AVAILABLE_STREAMS, |
| 681 QuicStrCat(new_num_available_streams, " above ", MaxAvailableStreams()), |
| 683 ConnectionCloseBehavior::SEND_CONNECTION_CLOSE_PACKET); | 682 ConnectionCloseBehavior::SEND_CONNECTION_CLOSE_PACKET); |
| 684 return false; | 683 return false; |
| 685 } | 684 } |
| 686 for (QuicStreamId id = largest_peer_created_stream_id_ + 2; id < stream_id; | 685 for (QuicStreamId id = largest_peer_created_stream_id_ + 2; id < stream_id; |
| 687 id += 2) { | 686 id += 2) { |
| 688 available_streams_.insert(id); | 687 available_streams_.insert(id); |
| 689 } | 688 } |
| 690 largest_peer_created_stream_id_ = stream_id; | 689 largest_peer_created_stream_id_ = stream_id; |
| 691 | 690 |
| 692 return true; | 691 return true; |
| (...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 859 | 858 |
| 860 size_t QuicSession::MaxAvailableStreams() const { | 859 size_t QuicSession::MaxAvailableStreams() const { |
| 861 return max_open_incoming_streams_ * kMaxAvailableStreamsMultiplier; | 860 return max_open_incoming_streams_ * kMaxAvailableStreamsMultiplier; |
| 862 } | 861 } |
| 863 | 862 |
| 864 bool QuicSession::IsIncomingStream(QuicStreamId id) const { | 863 bool QuicSession::IsIncomingStream(QuicStreamId id) const { |
| 865 return id % 2 != next_outgoing_stream_id_ % 2; | 864 return id % 2 != next_outgoing_stream_id_ % 2; |
| 866 } | 865 } |
| 867 | 866 |
| 868 } // namespace net | 867 } // namespace net |
| OLD | NEW |