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 // of the how many bytes the stream's flow controller believes it has | 421 // of the how many bytes the stream's flow controller believes it has |
422 // received, for accurate connection level flow control accounting. | 422 // received, for accurate connection level flow control accounting. |
423 if (!stream->HasFinalReceivedByteOffset() && | 423 if (!stream->HasFinalReceivedByteOffset() && |
424 stream->flow_controller()->IsEnabled()) { | 424 stream->flow_controller()->IsEnabled()) { |
425 locally_closed_streams_highest_offset_[stream_id] = | 425 locally_closed_streams_highest_offset_[stream_id] = |
426 stream->flow_controller()->highest_received_byte_offset(); | 426 stream->flow_controller()->highest_received_byte_offset(); |
427 } | 427 } |
428 | 428 |
429 stream_map_.erase(it); | 429 stream_map_.erase(it); |
430 stream->OnClose(); | 430 stream->OnClose(); |
| 431 // Decrease the number of streams being emulated when a new one is opened. |
| 432 connection_->SetNumOpenStreams(stream_map_.size()); |
431 } | 433 } |
432 | 434 |
433 void QuicSession::UpdateFlowControlOnFinalReceivedByteOffset( | 435 void QuicSession::UpdateFlowControlOnFinalReceivedByteOffset( |
434 QuicStreamId stream_id, QuicStreamOffset final_byte_offset) { | 436 QuicStreamId stream_id, QuicStreamOffset final_byte_offset) { |
435 map<QuicStreamId, QuicStreamOffset>::iterator it = | 437 map<QuicStreamId, QuicStreamOffset>::iterator it = |
436 locally_closed_streams_highest_offset_.find(stream_id); | 438 locally_closed_streams_highest_offset_.find(stream_id); |
437 if (it == locally_closed_streams_highest_offset_.end()) { | 439 if (it == locally_closed_streams_highest_offset_.end()) { |
438 return; | 440 return; |
439 } | 441 } |
440 | 442 |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
588 | 590 |
589 QuicConfig* QuicSession::config() { | 591 QuicConfig* QuicSession::config() { |
590 return &config_; | 592 return &config_; |
591 } | 593 } |
592 | 594 |
593 void QuicSession::ActivateStream(QuicDataStream* stream) { | 595 void QuicSession::ActivateStream(QuicDataStream* stream) { |
594 DVLOG(1) << ENDPOINT << "num_streams: " << stream_map_.size() | 596 DVLOG(1) << ENDPOINT << "num_streams: " << stream_map_.size() |
595 << ". activating " << stream->id(); | 597 << ". activating " << stream->id(); |
596 DCHECK_EQ(stream_map_.count(stream->id()), 0u); | 598 DCHECK_EQ(stream_map_.count(stream->id()), 0u); |
597 stream_map_[stream->id()] = stream; | 599 stream_map_[stream->id()] = stream; |
| 600 // Increase the number of streams being emulated when a new one is opened. |
| 601 connection_->SetNumOpenStreams(stream_map_.size()); |
598 } | 602 } |
599 | 603 |
600 QuicStreamId QuicSession::GetNextStreamId() { | 604 QuicStreamId QuicSession::GetNextStreamId() { |
601 QuicStreamId id = next_stream_id_; | 605 QuicStreamId id = next_stream_id_; |
602 next_stream_id_ += 2; | 606 next_stream_id_ += 2; |
603 return id; | 607 return id; |
604 } | 608 } |
605 | 609 |
606 ReliableQuicStream* QuicSession::GetStream(const QuicStreamId stream_id) { | 610 ReliableQuicStream* QuicSession::GetStream(const QuicStreamId stream_id) { |
607 if (stream_id == kCryptoStreamId) { | 611 if (stream_id == kCryptoStreamId) { |
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
784 for (DataStreamMap::iterator it = stream_map_.begin(); | 788 for (DataStreamMap::iterator it = stream_map_.begin(); |
785 it != stream_map_.end(); ++it) { | 789 it != stream_map_.end(); ++it) { |
786 if (it->second->flow_controller()->IsBlocked()) { | 790 if (it->second->flow_controller()->IsBlocked()) { |
787 return true; | 791 return true; |
788 } | 792 } |
789 } | 793 } |
790 return false; | 794 return false; |
791 } | 795 } |
792 | 796 |
793 } // namespace net | 797 } // namespace net |
OLD | NEW |