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_flow_controller.h" | 10 #include "net/quic/quic_flow_controller.h" |
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
248 // individual stream. | 248 // individual stream. |
249 DVLOG(1) << ENDPOINT | 249 DVLOG(1) << ENDPOINT |
250 << "Received connection level flow control window update with " | 250 << "Received connection level flow control window update with " |
251 "byte offset: " << frames[i].byte_offset; | 251 "byte offset: " << frames[i].byte_offset; |
252 if (flow_controller_->UpdateSendWindowOffset(frames[i].byte_offset)) { | 252 if (flow_controller_->UpdateSendWindowOffset(frames[i].byte_offset)) { |
253 connection_window_updated = true; | 253 connection_window_updated = true; |
254 } | 254 } |
255 continue; | 255 continue; |
256 } | 256 } |
257 | 257 |
258 if (connection_->version() < QUIC_VERSION_21 && | |
259 (stream_id == kCryptoStreamId || stream_id == kHeadersStreamId)) { | |
260 DLOG(DFATAL) << "WindowUpdate for stream " << stream_id << " in version " | |
261 << QuicVersionToString(connection_->version()); | |
262 return; | |
263 } | |
264 | |
265 ReliableQuicStream* stream = GetStream(stream_id); | 258 ReliableQuicStream* stream = GetStream(stream_id); |
266 if (stream) { | 259 if (stream) { |
267 stream->OnWindowUpdateFrame(frames[i]); | 260 stream->OnWindowUpdateFrame(frames[i]); |
268 } | 261 } |
269 } | 262 } |
270 | 263 |
271 // Connection level flow control window has increased, so blocked streams can | 264 // Connection level flow control window has increased, so blocked streams can |
272 // write again. | 265 // write again. |
273 if (connection_window_updated) { | 266 if (connection_window_updated) { |
274 OnCanWrite(); | 267 OnCanWrite(); |
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
491 LOG(ERROR) << "Peer sent us an invalid stream flow control send window: " | 484 LOG(ERROR) << "Peer sent us an invalid stream flow control send window: " |
492 << new_window | 485 << new_window |
493 << ", below default: " << kMinimumFlowControlSendWindow; | 486 << ", below default: " << kMinimumFlowControlSendWindow; |
494 if (connection_->connected()) { | 487 if (connection_->connected()) { |
495 connection_->SendConnectionClose(QUIC_FLOW_CONTROL_INVALID_WINDOW); | 488 connection_->SendConnectionClose(QUIC_FLOW_CONTROL_INVALID_WINDOW); |
496 } | 489 } |
497 return; | 490 return; |
498 } | 491 } |
499 | 492 |
500 // Inform all existing streams about the new window. | 493 // Inform all existing streams about the new window. |
501 if (connection_->version() >= QUIC_VERSION_21) { | 494 GetCryptoStream()->UpdateSendWindowOffset(new_window); |
502 GetCryptoStream()->UpdateSendWindowOffset(new_window); | 495 headers_stream_->UpdateSendWindowOffset(new_window); |
503 headers_stream_->UpdateSendWindowOffset(new_window); | |
504 } | |
505 for (DataStreamMap::iterator it = stream_map_.begin(); | 496 for (DataStreamMap::iterator it = stream_map_.begin(); |
506 it != stream_map_.end(); ++it) { | 497 it != stream_map_.end(); ++it) { |
507 it->second->UpdateSendWindowOffset(new_window); | 498 it->second->UpdateSendWindowOffset(new_window); |
508 } | 499 } |
509 } | 500 } |
510 | 501 |
511 void QuicSession::OnNewSessionFlowControlWindow(QuicStreamOffset new_window) { | 502 void QuicSession::OnNewSessionFlowControlWindow(QuicStreamOffset new_window) { |
512 if (new_window < kMinimumFlowControlSendWindow) { | 503 if (new_window < kMinimumFlowControlSendWindow) { |
513 LOG(ERROR) << "Peer sent us an invalid session flow control send window: " | 504 LOG(ERROR) << "Peer sent us an invalid session flow control send window: " |
514 << new_window | 505 << new_window |
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
746 for (DataStreamMap::iterator it = stream_map_.begin(); | 737 for (DataStreamMap::iterator it = stream_map_.begin(); |
747 it != stream_map_.end(); ++it) { | 738 it != stream_map_.end(); ++it) { |
748 if (it->second->flow_controller()->IsBlocked()) { | 739 if (it->second->flow_controller()->IsBlocked()) { |
749 return true; | 740 return true; |
750 } | 741 } |
751 } | 742 } |
752 return false; | 743 return false; |
753 } | 744 } |
754 | 745 |
755 } // namespace net | 746 } // namespace net |
OLD | NEW |