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 412 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
423 | 423 |
424 closed_streams_.push_back(it->second); | 424 closed_streams_.push_back(it->second); |
425 | 425 |
426 // If we haven't received a FIN or RST for this stream, we need to keep track | 426 // If we haven't received a FIN or RST for this stream, we need to keep track |
427 // of the how many bytes the stream's flow controller believes it has | 427 // of the how many bytes the stream's flow controller believes it has |
428 // received, for accurate connection level flow control accounting. | 428 // received, for accurate connection level flow control accounting. |
429 if (!stream->HasFinalReceivedByteOffset() && | 429 if (!stream->HasFinalReceivedByteOffset() && |
430 stream->flow_controller()->IsEnabled()) { | 430 stream->flow_controller()->IsEnabled()) { |
431 locally_closed_streams_highest_offset_[stream_id] = | 431 locally_closed_streams_highest_offset_[stream_id] = |
432 stream->flow_controller()->highest_received_byte_offset(); | 432 stream->flow_controller()->highest_received_byte_offset(); |
| 433 if (FLAGS_close_quic_connection_unfinished_streams && |
| 434 connection()->connected() && |
| 435 locally_closed_streams_highest_offset_.size() > max_open_streams_) { |
| 436 // A buggy client may fail to send FIN/RSTs. Don't tolerate this. |
| 437 connection_->SendConnectionClose(QUIC_TOO_MANY_UNFINISHED_STREAMS); |
| 438 } |
433 } | 439 } |
434 | 440 |
435 stream_map_.erase(it); | 441 stream_map_.erase(it); |
436 stream->OnClose(); | 442 stream->OnClose(); |
437 } | 443 } |
438 | 444 |
439 void QuicSession::UpdateFlowControlOnFinalReceivedByteOffset( | 445 void QuicSession::UpdateFlowControlOnFinalReceivedByteOffset( |
440 QuicStreamId stream_id, QuicStreamOffset final_byte_offset) { | 446 QuicStreamId stream_id, QuicStreamOffset final_byte_offset) { |
441 map<QuicStreamId, QuicStreamOffset>::iterator it = | 447 map<QuicStreamId, QuicStreamOffset>::iterator it = |
442 locally_closed_streams_highest_offset_.find(stream_id); | 448 locally_closed_streams_highest_offset_.find(stream_id); |
(...skipping 312 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
755 } | 761 } |
756 for (DataStreamMap::iterator it = stream_map_.begin(); | 762 for (DataStreamMap::iterator it = stream_map_.begin(); |
757 it != stream_map_.end(); ++it) { | 763 it != stream_map_.end(); ++it) { |
758 if (version <= QUIC_VERSION_16) { | 764 if (version <= QUIC_VERSION_16) { |
759 it->second->flow_controller()->Disable(); | 765 it->second->flow_controller()->Disable(); |
760 } | 766 } |
761 } | 767 } |
762 } | 768 } |
763 | 769 |
764 } // namespace net | 770 } // namespace net |
OLD | NEW |