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

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

Issue 1277723003: Landing Recent QUIC changes until 8/4/2015 20:30 UTC. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Dont enable FLAGS_quic_require_handshake_confirmation to fix crypto tests Created 5 years, 4 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_sent_packet_manager_test.cc ('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 #ifdef TEMP_INSTRUMENTATION_473893 8 #ifdef TEMP_INSTRUMENTATION_473893
9 #include "base/debug/alias.h" 9 #include "base/debug/alias.h"
10 #endif 10 #endif
(...skipping 593 matching lines...) Expand 10 before | Expand all | Expand 10 after
604 } 604 }
605 605
606 return GetIncomingDynamicStream(stream_id); 606 return GetIncomingDynamicStream(stream_id);
607 } 607 }
608 608
609 ReliableQuicStream* QuicSession::GetIncomingDynamicStream( 609 ReliableQuicStream* QuicSession::GetIncomingDynamicStream(
610 QuicStreamId stream_id) { 610 QuicStreamId stream_id) {
611 if (IsClosedStream(stream_id)) { 611 if (IsClosedStream(stream_id)) {
612 return nullptr; 612 return nullptr;
613 } 613 }
614
615 implicitly_created_streams_.erase(stream_id); 614 implicitly_created_streams_.erase(stream_id);
616 if (stream_id > largest_peer_created_stream_id_) { 615 if (stream_id > largest_peer_created_stream_id_) {
617 if (stream_id - largest_peer_created_stream_id_ > kMaxStreamIdDelta) { 616 if (FLAGS_exact_stream_id_delta) {
618 // We may already have sent a connection close due to multiple reset 617 // Check if the number of streams that will be created (including
619 // streams in the same packet. 618 // implicitly open streams) would cause the number of open streams to
620 if (connection()->connected()) { 619 // exceed the limit. Note that the peer can create only
621 LOG(ERROR) << "Trying to get stream: " << stream_id 620 // alternately-numbered streams.
622 << ", largest peer created stream: " 621 if ((stream_id - largest_peer_created_stream_id_) / 2 +
623 << largest_peer_created_stream_id_ 622 GetNumOpenStreams() >
624 << ", max delta: " << kMaxStreamIdDelta; 623 get_max_open_streams()) {
625 connection()->SendConnectionClose(QUIC_INVALID_STREAM_ID); 624 DVLOG(1) << "Failed to create a new incoming stream with id:"
625 << stream_id << ". Already " << GetNumOpenStreams()
626 << " streams open, would exceed max " << get_max_open_streams()
627 << ".";
628 // We may already have sent a connection close due to multiple reset
629 // streams in the same packet.
630 if (connection()->connected()) {
631 connection()->SendConnectionClose(QUIC_TOO_MANY_OPEN_STREAMS);
632 }
633 return nullptr;
626 } 634 }
627 return nullptr; 635 } else {
636 // Limit on the delta between stream IDs.
637 const QuicStreamId kMaxStreamIdDelta = 200;
638 if (stream_id - largest_peer_created_stream_id_ > kMaxStreamIdDelta) {
639 // We may already have sent a connection close due to multiple reset
640 // streams in the same packet.
641 if (connection()->connected()) {
642 LOG(ERROR) << "Trying to get stream: " << stream_id
643 << ", largest peer created stream: "
644 << largest_peer_created_stream_id_
645 << ", max delta: " << kMaxStreamIdDelta;
646 connection()->SendConnectionClose(QUIC_INVALID_STREAM_ID);
647 }
648 return nullptr;
649 }
628 } 650 }
629 for (QuicStreamId id = largest_peer_created_stream_id_ + 2; 651 for (QuicStreamId id = largest_peer_created_stream_id_ + 2;
630 id < stream_id; 652 id < stream_id;
631 id += 2) { 653 id += 2) {
632 implicitly_created_streams_.insert(id); 654 implicitly_created_streams_.insert(id);
633 } 655 }
634 largest_peer_created_stream_id_ = stream_id; 656 largest_peer_created_stream_id_ = stream_id;
635 } 657 }
636 ReliableQuicStream* stream = CreateIncomingDynamicStream(stream_id); 658 ReliableQuicStream* stream = CreateIncomingDynamicStream(stream_id);
637 if (stream == nullptr) { 659 if (stream == nullptr) {
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after
740 base::debug::StackTrace stack_trace = stack_trace_; 762 base::debug::StackTrace stack_trace = stack_trace_;
741 763
742 base::debug::Alias(&liveness); 764 base::debug::Alias(&liveness);
743 base::debug::Alias(&stack_trace); 765 base::debug::Alias(&stack_trace);
744 766
745 CHECK_EQ(ALIVE, liveness); 767 CHECK_EQ(ALIVE, liveness);
746 #endif 768 #endif
747 } 769 }
748 770
749 } // namespace net 771 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/quic_sent_packet_manager_test.cc ('k') | net/quic/quic_session_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698