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

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

Issue 1761263002: Landing recent QUIC changes until 7:19 PM, Feb 26, 2016 UTC-5. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add ActivateStream() call to QuicChromiumClientSession to fix server push failure Created 4 years, 9 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
« no previous file with comments | « net/quic/quic_session.h ('k') | net/quic/quic_session_test.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/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
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
694 ReliableQuicStream* stream = CreateIncomingDynamicStream(stream_id); 689 return CreateIncomingDynamicStream(stream_id);
695 if (stream == nullptr) {
696 return nullptr;
697 }
698 ActivateStream(stream);
699 return stream;
700 } 690 }
701 691
702 void QuicSession::set_max_open_incoming_streams( 692 void QuicSession::set_max_open_incoming_streams(
703 size_t max_open_incoming_streams) { 693 size_t max_open_incoming_streams) {
704 DVLOG(1) << "Setting max_open_incoming_streams_ to " 694 DVLOG(1) << "Setting max_open_incoming_streams_ to "
705 << max_open_incoming_streams; 695 << max_open_incoming_streams;
706 max_open_incoming_streams_ = max_open_incoming_streams; 696 max_open_incoming_streams_ = max_open_incoming_streams;
707 DVLOG(1) << "MaxAvailableStreams() became " << MaxAvailableStreams(); 697 DVLOG(1) << "MaxAvailableStreams() became " << MaxAvailableStreams();
708 } 698 }
709 699
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
817 807
818 size_t QuicSession::MaxAvailableStreams() const { 808 size_t QuicSession::MaxAvailableStreams() const {
819 return max_open_incoming_streams_ * kMaxAvailableStreamsMultiplier; 809 return max_open_incoming_streams_ * kMaxAvailableStreamsMultiplier;
820 } 810 }
821 811
822 bool QuicSession::IsIncomingStream(QuicStreamId id) const { 812 bool QuicSession::IsIncomingStream(QuicStreamId id) const {
823 return id % 2 != next_outgoing_stream_id_ % 2; 813 return id % 2 != next_outgoing_stream_id_ % 2;
824 } 814 }
825 815
826 } // namespace net 816 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/quic_session.h ('k') | net/quic/quic_session_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698