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 "net/quic/crypto/proof_verifier.h" | 8 #include "net/quic/crypto/proof_verifier.h" |
9 #include "net/quic/quic_connection.h" | 9 #include "net/quic/quic_connection.h" |
10 #include "net/quic/quic_flags.h" | 10 #include "net/quic/quic_flags.h" |
(...skipping 410 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
421 | 421 |
422 closed_streams_.push_back(it->second); | 422 closed_streams_.push_back(it->second); |
423 | 423 |
424 // If we haven't received a FIN or RST for this stream, we need to keep track | 424 // If we haven't received a FIN or RST for this stream, we need to keep track |
425 // of the how many bytes the stream's flow controller believes it has | 425 // of the how many bytes the stream's flow controller believes it has |
426 // received, for accurate connection level flow control accounting. | 426 // received, for accurate connection level flow control accounting. |
427 if (!stream->HasFinalReceivedByteOffset() && | 427 if (!stream->HasFinalReceivedByteOffset() && |
428 stream->flow_controller()->IsEnabled()) { | 428 stream->flow_controller()->IsEnabled()) { |
429 locally_closed_streams_highest_offset_[stream_id] = | 429 locally_closed_streams_highest_offset_[stream_id] = |
430 stream->flow_controller()->highest_received_byte_offset(); | 430 stream->flow_controller()->highest_received_byte_offset(); |
431 if (FLAGS_close_quic_connection_unfinished_streams && | |
432 connection()->connected() && | |
433 locally_closed_streams_highest_offset_.size() > max_open_streams_) { | |
434 // A buggy client may fail to send FIN/RSTs. Don't tolerate this. | |
435 connection_->SendConnectionClose(QUIC_TOO_MANY_UNFINISHED_STREAMS); | |
436 } | |
437 } | 431 } |
438 | 432 |
439 stream_map_.erase(it); | 433 stream_map_.erase(it); |
440 stream->OnClose(); | 434 stream->OnClose(); |
441 } | 435 } |
442 | 436 |
443 void QuicSession::UpdateFlowControlOnFinalReceivedByteOffset( | 437 void QuicSession::UpdateFlowControlOnFinalReceivedByteOffset( |
444 QuicStreamId stream_id, QuicStreamOffset final_byte_offset) { | 438 QuicStreamId stream_id, QuicStreamOffset final_byte_offset) { |
445 map<QuicStreamId, QuicStreamOffset>::iterator it = | 439 map<QuicStreamId, QuicStreamOffset>::iterator it = |
446 locally_closed_streams_highest_offset_.find(stream_id); | 440 locally_closed_streams_highest_offset_.find(stream_id); |
(...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
753 } | 747 } |
754 | 748 |
755 bool QuicSession::GetSSLInfo(SSLInfo* ssl_info) const { | 749 bool QuicSession::GetSSLInfo(SSLInfo* ssl_info) const { |
756 NOTIMPLEMENTED(); | 750 NOTIMPLEMENTED(); |
757 return false; | 751 return false; |
758 } | 752 } |
759 | 753 |
760 void QuicSession::PostProcessAfterData() { | 754 void QuicSession::PostProcessAfterData() { |
761 STLDeleteElements(&closed_streams_); | 755 STLDeleteElements(&closed_streams_); |
762 closed_streams_.clear(); | 756 closed_streams_.clear(); |
| 757 |
| 758 if (FLAGS_close_quic_connection_unfinished_streams_2 && |
| 759 connection()->connected() && |
| 760 locally_closed_streams_highest_offset_.size() > max_open_streams_) { |
| 761 // A buggy client may fail to send FIN/RSTs. Don't tolerate this. |
| 762 connection_->SendConnectionClose(QUIC_TOO_MANY_UNFINISHED_STREAMS); |
| 763 } |
763 } | 764 } |
764 | 765 |
765 void QuicSession::OnSuccessfulVersionNegotiation(const QuicVersion& version) { | 766 void QuicSession::OnSuccessfulVersionNegotiation(const QuicVersion& version) { |
766 if (version < QUIC_VERSION_19) { | 767 if (version < QUIC_VERSION_19) { |
767 flow_controller_->Disable(); | 768 flow_controller_->Disable(); |
768 } | 769 } |
769 | 770 |
770 // Disable stream level flow control based on negotiated version. Streams may | 771 // Disable stream level flow control based on negotiated version. Streams may |
771 // have been created with a different version. | 772 // have been created with a different version. |
772 if (version < QUIC_VERSION_21) { | 773 if (version < QUIC_VERSION_21) { |
773 GetCryptoStream()->flow_controller()->Disable(); | 774 GetCryptoStream()->flow_controller()->Disable(); |
774 headers_stream_->flow_controller()->Disable(); | 775 headers_stream_->flow_controller()->Disable(); |
775 } | 776 } |
776 for (DataStreamMap::iterator it = stream_map_.begin(); | 777 for (DataStreamMap::iterator it = stream_map_.begin(); |
777 it != stream_map_.end(); ++it) { | 778 it != stream_map_.end(); ++it) { |
778 if (version <= QUIC_VERSION_16) { | 779 if (version <= QUIC_VERSION_16) { |
779 it->second->flow_controller()->Disable(); | 780 it->second->flow_controller()->Disable(); |
780 } | 781 } |
781 } | 782 } |
782 } | 783 } |
783 | 784 |
784 } // namespace net | 785 } // namespace net |
OLD | NEW |