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 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
255 for (size_t i = 0; i < frames.size(); ++i) { | 255 for (size_t i = 0; i < frames.size(); ++i) { |
256 // Stream may be closed by the time we receive a WINDOW_UPDATE, so we can't | 256 // Stream may be closed by the time we receive a WINDOW_UPDATE, so we can't |
257 // assume that it still exists. | 257 // assume that it still exists. |
258 QuicStreamId stream_id = frames[i].stream_id; | 258 QuicStreamId stream_id = frames[i].stream_id; |
259 if (stream_id == kConnectionLevelId) { | 259 if (stream_id == kConnectionLevelId) { |
260 // This is a window update that applies to the connection, rather than an | 260 // This is a window update that applies to the connection, rather than an |
261 // individual stream. | 261 // individual stream. |
262 DVLOG(1) << ENDPOINT | 262 DVLOG(1) << ENDPOINT |
263 << "Received connection level flow control window update with " | 263 << "Received connection level flow control window update with " |
264 "byte offset: " << frames[i].byte_offset; | 264 "byte offset: " << frames[i].byte_offset; |
265 if (FLAGS_enable_quic_connection_flow_control_2 && | 265 if (flow_controller_->UpdateSendWindowOffset(frames[i].byte_offset)) { |
266 flow_controller_->UpdateSendWindowOffset(frames[i].byte_offset)) { | |
267 connection_window_updated = true; | 266 connection_window_updated = true; |
268 } | 267 } |
269 continue; | 268 continue; |
270 } | 269 } |
271 | 270 |
272 if (connection_->version() <= QUIC_VERSION_20 && | 271 if (connection_->version() <= QUIC_VERSION_20 && |
273 (stream_id == kCryptoStreamId || stream_id == kHeadersStreamId)) { | 272 (stream_id == kCryptoStreamId || stream_id == kHeadersStreamId)) { |
274 DLOG(DFATAL) << "WindowUpdate for stream " << stream_id << " in version " | 273 DLOG(DFATAL) << "WindowUpdate for stream " << stream_id << " in version " |
275 << QuicVersionToString(connection_->version()); | 274 << QuicVersionToString(connection_->version()); |
276 return; | 275 return; |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
421 if (locally_reset) { | 420 if (locally_reset) { |
422 stream->set_rst_sent(true); | 421 stream->set_rst_sent(true); |
423 } | 422 } |
424 | 423 |
425 closed_streams_.push_back(it->second); | 424 closed_streams_.push_back(it->second); |
426 | 425 |
427 // 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 |
428 // 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 |
429 // received, for accurate connection level flow control accounting. | 428 // received, for accurate connection level flow control accounting. |
430 if (!stream->HasFinalReceivedByteOffset() && | 429 if (!stream->HasFinalReceivedByteOffset() && |
431 stream->flow_controller()->IsEnabled() && | 430 stream->flow_controller()->IsEnabled()) { |
432 FLAGS_enable_quic_connection_flow_control_2) { | |
433 locally_closed_streams_highest_offset_[stream_id] = | 431 locally_closed_streams_highest_offset_[stream_id] = |
434 stream->flow_controller()->highest_received_byte_offset(); | 432 stream->flow_controller()->highest_received_byte_offset(); |
435 } | 433 } |
436 | 434 |
437 stream_map_.erase(it); | 435 stream_map_.erase(it); |
438 stream->OnClose(); | 436 stream->OnClose(); |
439 } | 437 } |
440 | 438 |
441 void QuicSession::UpdateFlowControlOnFinalReceivedByteOffset( | 439 void QuicSession::UpdateFlowControlOnFinalReceivedByteOffset( |
442 QuicStreamId stream_id, QuicStreamOffset final_byte_offset) { | 440 QuicStreamId stream_id, QuicStreamOffset final_byte_offset) { |
443 if (!FLAGS_enable_quic_connection_flow_control_2) { | |
444 return; | |
445 } | |
446 | |
447 map<QuicStreamId, QuicStreamOffset>::iterator it = | 441 map<QuicStreamId, QuicStreamOffset>::iterator it = |
448 locally_closed_streams_highest_offset_.find(stream_id); | 442 locally_closed_streams_highest_offset_.find(stream_id); |
449 if (it == locally_closed_streams_highest_offset_.end()) { | 443 if (it == locally_closed_streams_highest_offset_.end()) { |
450 return; | 444 return; |
451 } | 445 } |
452 | 446 |
453 DVLOG(1) << ENDPOINT << "Received final byte offset " << final_byte_offset | 447 DVLOG(1) << ENDPOINT << "Received final byte offset " << final_byte_offset |
454 << " for stream " << stream_id; | 448 << " for stream " << stream_id; |
455 uint64 offset_diff = final_byte_offset - it->second; | 449 uint64 offset_diff = final_byte_offset - it->second; |
456 if (flow_controller_->UpdateHighestReceivedOffset( | 450 if (flow_controller_->UpdateHighestReceivedOffset( |
(...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
761 } | 755 } |
762 for (DataStreamMap::iterator it = stream_map_.begin(); | 756 for (DataStreamMap::iterator it = stream_map_.begin(); |
763 it != stream_map_.end(); ++it) { | 757 it != stream_map_.end(); ++it) { |
764 if (version <= QUIC_VERSION_16) { | 758 if (version <= QUIC_VERSION_16) { |
765 it->second->flow_controller()->Disable(); | 759 it->second->flow_controller()->Disable(); |
766 } | 760 } |
767 } | 761 } |
768 } | 762 } |
769 | 763 |
770 } // namespace net | 764 } // namespace net |
OLD | NEW |