| 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 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 246 for (size_t i = 0; i < frames.size(); ++i) { | 246 for (size_t i = 0; i < frames.size(); ++i) { |
| 247 // Stream may be closed by the time we receive a WINDOW_UPDATE, so we can't | 247 // Stream may be closed by the time we receive a WINDOW_UPDATE, so we can't |
| 248 // assume that it still exists. | 248 // assume that it still exists. |
| 249 QuicStreamId stream_id = frames[i].stream_id; | 249 QuicStreamId stream_id = frames[i].stream_id; |
| 250 if (stream_id == 0) { | 250 if (stream_id == 0) { |
| 251 // This is a window update that applies to the connection, rather than an | 251 // This is a window update that applies to the connection, rather than an |
| 252 // individual stream. | 252 // individual stream. |
| 253 DVLOG(1) << ENDPOINT | 253 DVLOG(1) << ENDPOINT |
| 254 << "Received connection level flow control window update with " | 254 << "Received connection level flow control window update with " |
| 255 "byte offset: " << frames[i].byte_offset; | 255 "byte offset: " << frames[i].byte_offset; |
| 256 if (FLAGS_enable_quic_connection_flow_control && | 256 if (FLAGS_enable_quic_connection_flow_control_2 && |
| 257 flow_controller_->UpdateSendWindowOffset(frames[i].byte_offset)) { | 257 flow_controller_->UpdateSendWindowOffset(frames[i].byte_offset)) { |
| 258 connection_window_updated = true; | 258 connection_window_updated = true; |
| 259 } | 259 } |
| 260 continue; | 260 continue; |
| 261 } | 261 } |
| 262 | 262 |
| 263 QuicDataStream* stream = GetDataStream(stream_id); | 263 QuicDataStream* stream = GetDataStream(stream_id); |
| 264 if (stream) { | 264 if (stream) { |
| 265 stream->OnWindowUpdateFrame(frames[i]); | 265 stream->OnWindowUpdateFrame(frames[i]); |
| 266 } | 266 } |
| (...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 406 stream->set_rst_sent(true); | 406 stream->set_rst_sent(true); |
| 407 } | 407 } |
| 408 | 408 |
| 409 closed_streams_.push_back(it->second); | 409 closed_streams_.push_back(it->second); |
| 410 | 410 |
| 411 // If we haven't received a FIN or RST for this stream, we need to keep track | 411 // If we haven't received a FIN or RST for this stream, we need to keep track |
| 412 // of the how many bytes the stream's flow controller believes it has | 412 // of the how many bytes the stream's flow controller believes it has |
| 413 // received, for accurate connection level flow control accounting. | 413 // received, for accurate connection level flow control accounting. |
| 414 if (!stream->HasFinalReceivedByteOffset() && | 414 if (!stream->HasFinalReceivedByteOffset() && |
| 415 stream->flow_controller()->IsEnabled() && | 415 stream->flow_controller()->IsEnabled() && |
| 416 FLAGS_enable_quic_connection_flow_control) { | 416 FLAGS_enable_quic_connection_flow_control_2) { |
| 417 locally_closed_streams_highest_offset_[stream_id] = | 417 locally_closed_streams_highest_offset_[stream_id] = |
| 418 stream->flow_controller()->highest_received_byte_offset(); | 418 stream->flow_controller()->highest_received_byte_offset(); |
| 419 } | 419 } |
| 420 | 420 |
| 421 stream_map_.erase(it); | 421 stream_map_.erase(it); |
| 422 stream->OnClose(); | 422 stream->OnClose(); |
| 423 } | 423 } |
| 424 | 424 |
| 425 void QuicSession::UpdateFlowControlOnFinalReceivedByteOffset( | 425 void QuicSession::UpdateFlowControlOnFinalReceivedByteOffset( |
| 426 QuicStreamId stream_id, QuicStreamOffset final_byte_offset) { | 426 QuicStreamId stream_id, QuicStreamOffset final_byte_offset) { |
| 427 if (!FLAGS_enable_quic_connection_flow_control) { | 427 if (!FLAGS_enable_quic_connection_flow_control_2) { |
| 428 return; | 428 return; |
| 429 } | 429 } |
| 430 | 430 |
| 431 map<QuicStreamId, QuicStreamOffset>::iterator it = | 431 map<QuicStreamId, QuicStreamOffset>::iterator it = |
| 432 locally_closed_streams_highest_offset_.find(stream_id); | 432 locally_closed_streams_highest_offset_.find(stream_id); |
| 433 if (it == locally_closed_streams_highest_offset_.end()) { | 433 if (it == locally_closed_streams_highest_offset_.end()) { |
| 434 return; | 434 return; |
| 435 } | 435 } |
| 436 | 436 |
| 437 DVLOG(1) << ENDPOINT << "Received final byte offset " << final_byte_offset | 437 DVLOG(1) << ENDPOINT << "Received final byte offset " << final_byte_offset |
| (...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 714 // with a different version. | 714 // with a different version. |
| 715 for (DataStreamMap::iterator it = stream_map_.begin(); | 715 for (DataStreamMap::iterator it = stream_map_.begin(); |
| 716 it != stream_map_.end(); ++it) { | 716 it != stream_map_.end(); ++it) { |
| 717 if (version < QUIC_VERSION_17) { | 717 if (version < QUIC_VERSION_17) { |
| 718 it->second->flow_controller()->Disable(); | 718 it->second->flow_controller()->Disable(); |
| 719 } | 719 } |
| 720 } | 720 } |
| 721 } | 721 } |
| 722 | 722 |
| 723 } // namespace net | 723 } // namespace net |
| OLD | NEW |