Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(90)

Side by Side Diff: net/quic/core/quic_session.cc

Issue 2591143003: Add QuicStrCat. (Closed)
Patch Set: fix include Created 3 years, 12 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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"
11 #include "net/quic/core/quic_bug_tracker.h" 11 #include "net/quic/core/quic_bug_tracker.h"
12 #include "net/quic/core/quic_connection.h" 12 #include "net/quic/core/quic_connection.h"
13 #include "net/quic/core/quic_flags.h" 13 #include "net/quic/core/quic_flags.h"
14 #include "net/quic/core/quic_flow_controller.h" 14 #include "net/quic/core/quic_flow_controller.h"
15 #include "net/quic/platform/api/quic_str_cat.h"
15 16
16 using base::IntToString; 17 using base::IntToString;
17 using base::StringPiece; 18 using base::StringPiece;
18 using std::string; 19 using std::string;
19 using net::SpdyPriority; 20 using net::SpdyPriority;
20 21
21 namespace net { 22 namespace net {
22 23
23 #define ENDPOINT \ 24 #define ENDPOINT \
24 (perspective() == Perspective::IS_SERVER ? "Server: " : " Client: ") 25 (perspective() == Perspective::IS_SERVER ? "Server: " : " Client: ")
(...skipping 644 matching lines...) Expand 10 before | Expand all | Expand 10 after
669 (stream_id - largest_peer_created_stream_id_) / 2 - 1; 670 (stream_id - largest_peer_created_stream_id_) / 2 - 1;
670 size_t new_num_available_streams = 671 size_t new_num_available_streams =
671 GetNumAvailableStreams() + additional_available_streams; 672 GetNumAvailableStreams() + additional_available_streams;
672 if (new_num_available_streams > MaxAvailableStreams()) { 673 if (new_num_available_streams > MaxAvailableStreams()) {
673 DVLOG(1) << ENDPOINT 674 DVLOG(1) << ENDPOINT
674 << "Failed to create a new incoming stream with id:" << stream_id 675 << "Failed to create a new incoming stream with id:" << stream_id
675 << ". There are already " << GetNumAvailableStreams() 676 << ". There are already " << GetNumAvailableStreams()
676 << " streams available, which would become " 677 << " streams available, which would become "
677 << new_num_available_streams << ", which exceeds the limit " 678 << new_num_available_streams << ", which exceeds the limit "
678 << MaxAvailableStreams() << "."; 679 << MaxAvailableStreams() << ".";
679 string details = IntToString(new_num_available_streams) + " above " +
680 IntToString(MaxAvailableStreams());
681 connection()->CloseConnection( 680 connection()->CloseConnection(
682 QUIC_TOO_MANY_AVAILABLE_STREAMS, details.c_str(), 681 QUIC_TOO_MANY_AVAILABLE_STREAMS,
682 QuicStrCat(new_num_available_streams, " above ", MaxAvailableStreams()),
683 ConnectionCloseBehavior::SEND_CONNECTION_CLOSE_PACKET); 683 ConnectionCloseBehavior::SEND_CONNECTION_CLOSE_PACKET);
684 return false; 684 return false;
685 } 685 }
686 for (QuicStreamId id = largest_peer_created_stream_id_ + 2; id < stream_id; 686 for (QuicStreamId id = largest_peer_created_stream_id_ + 2; id < stream_id;
687 id += 2) { 687 id += 2) {
688 available_streams_.insert(id); 688 available_streams_.insert(id);
689 } 689 }
690 largest_peer_created_stream_id_ = stream_id; 690 largest_peer_created_stream_id_ = stream_id;
691 691
692 return true; 692 return true;
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
859 859
860 size_t QuicSession::MaxAvailableStreams() const { 860 size_t QuicSession::MaxAvailableStreams() const {
861 return max_open_incoming_streams_ * kMaxAvailableStreamsMultiplier; 861 return max_open_incoming_streams_ * kMaxAvailableStreamsMultiplier;
862 } 862 }
863 863
864 bool QuicSession::IsIncomingStream(QuicStreamId id) const { 864 bool QuicSession::IsIncomingStream(QuicStreamId id) const {
865 return id % 2 != next_outgoing_stream_id_ % 2; 865 return id % 2 != next_outgoing_stream_id_ % 2;
866 } 866 }
867 867
868 } // namespace net 868 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698