| 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 246 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 257 for (size_t i = 0; i < frames.size(); ++i) { | 257 for (size_t i = 0; i < frames.size(); ++i) { |
| 258 // Stream may be closed by the time we receive a WINDOW_UPDATE, so we can't | 258 // Stream may be closed by the time we receive a WINDOW_UPDATE, so we can't |
| 259 // assume that it still exists. | 259 // assume that it still exists. |
| 260 QuicStreamId stream_id = frames[i].stream_id; | 260 QuicStreamId stream_id = frames[i].stream_id; |
| 261 if (stream_id == 0) { | 261 if (stream_id == 0) { |
| 262 // This is a window update that applies to the connection, rather than an | 262 // This is a window update that applies to the connection, rather than an |
| 263 // individual stream. | 263 // individual stream. |
| 264 DVLOG(1) << ENDPOINT | 264 DVLOG(1) << ENDPOINT |
| 265 << "Received connection level flow control window update with " | 265 << "Received connection level flow control window update with " |
| 266 "byte offset: " << frames[i].byte_offset; | 266 "byte offset: " << frames[i].byte_offset; |
| 267 if (FLAGS_enable_quic_connection_flow_control && | 267 if (FLAGS_enable_quic_connection_flow_control_2 && |
| 268 flow_controller_->UpdateSendWindowOffset(frames[i].byte_offset)) { | 268 flow_controller_->UpdateSendWindowOffset(frames[i].byte_offset)) { |
| 269 connection_window_updated = true; | 269 connection_window_updated = true; |
| 270 } | 270 } |
| 271 continue; | 271 continue; |
| 272 } | 272 } |
| 273 | 273 |
| 274 QuicDataStream* stream = GetDataStream(stream_id); | 274 QuicDataStream* stream = GetDataStream(stream_id); |
| 275 if (stream) { | 275 if (stream) { |
| 276 stream->OnWindowUpdateFrame(frames[i]); | 276 stream->OnWindowUpdateFrame(frames[i]); |
| 277 } | 277 } |
| (...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 417 stream->set_rst_sent(true); | 417 stream->set_rst_sent(true); |
| 418 } | 418 } |
| 419 | 419 |
| 420 closed_streams_.push_back(it->second); | 420 closed_streams_.push_back(it->second); |
| 421 | 421 |
| 422 // If we haven't received a FIN or RST for this stream, we need to keep track | 422 // If we haven't received a FIN or RST for this stream, we need to keep track |
| 423 // of the how many bytes the stream's flow controller believes it has | 423 // of the how many bytes the stream's flow controller believes it has |
| 424 // received, for accurate connection level flow control accounting. | 424 // received, for accurate connection level flow control accounting. |
| 425 if (!stream->HasFinalReceivedByteOffset() && | 425 if (!stream->HasFinalReceivedByteOffset() && |
| 426 stream->flow_controller()->IsEnabled() && | 426 stream->flow_controller()->IsEnabled() && |
| 427 FLAGS_enable_quic_connection_flow_control) { | 427 FLAGS_enable_quic_connection_flow_control_2) { |
| 428 locally_closed_streams_highest_offset_[stream_id] = | 428 locally_closed_streams_highest_offset_[stream_id] = |
| 429 stream->flow_controller()->highest_received_byte_offset(); | 429 stream->flow_controller()->highest_received_byte_offset(); |
| 430 } | 430 } |
| 431 | 431 |
| 432 stream_map_.erase(it); | 432 stream_map_.erase(it); |
| 433 stream->OnClose(); | 433 stream->OnClose(); |
| 434 } | 434 } |
| 435 | 435 |
| 436 void QuicSession::UpdateFlowControlOnFinalReceivedByteOffset( | 436 void QuicSession::UpdateFlowControlOnFinalReceivedByteOffset( |
| 437 QuicStreamId stream_id, QuicStreamOffset final_byte_offset) { | 437 QuicStreamId stream_id, QuicStreamOffset final_byte_offset) { |
| 438 if (!FLAGS_enable_quic_connection_flow_control) { | 438 if (!FLAGS_enable_quic_connection_flow_control_2) { |
| 439 return; | 439 return; |
| 440 } | 440 } |
| 441 | 441 |
| 442 map<QuicStreamId, QuicStreamOffset>::iterator it = | 442 map<QuicStreamId, QuicStreamOffset>::iterator it = |
| 443 locally_closed_streams_highest_offset_.find(stream_id); | 443 locally_closed_streams_highest_offset_.find(stream_id); |
| 444 if (it == locally_closed_streams_highest_offset_.end()) { | 444 if (it == locally_closed_streams_highest_offset_.end()) { |
| 445 return; | 445 return; |
| 446 } | 446 } |
| 447 | 447 |
| 448 DVLOG(1) << ENDPOINT << "Received final byte offset " << final_byte_offset | 448 DVLOG(1) << ENDPOINT << "Received final byte offset " << final_byte_offset |
| (...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 710 // with a different version. | 710 // with a different version. |
| 711 for (DataStreamMap::iterator it = stream_map_.begin(); | 711 for (DataStreamMap::iterator it = stream_map_.begin(); |
| 712 it != stream_map_.end(); ++it) { | 712 it != stream_map_.end(); ++it) { |
| 713 if (version < QUIC_VERSION_17) { | 713 if (version < QUIC_VERSION_17) { |
| 714 it->second->flow_controller()->Disable(); | 714 it->second->flow_controller()->Disable(); |
| 715 } | 715 } |
| 716 } | 716 } |
| 717 } | 717 } |
| 718 | 718 |
| 719 } // namespace net | 719 } // namespace net |
| OLD | NEW |