| 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/reliable_quic_stream.h" | 5 #include "net/quic/reliable_quic_stream.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "net/quic/iovector.h" | 8 #include "net/quic/iovector.h" |
| 9 #include "net/quic/quic_flow_controller.h" | 9 #include "net/quic/quic_flow_controller.h" |
| 10 #include "net/quic/quic_session.h" | 10 #include "net/quic/quic_session.h" |
| (...skipping 390 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 401 void ReliableQuicStream::OnClose() { | 401 void ReliableQuicStream::OnClose() { |
| 402 CloseReadSide(); | 402 CloseReadSide(); |
| 403 CloseWriteSide(); | 403 CloseWriteSide(); |
| 404 | 404 |
| 405 if (version() > QUIC_VERSION_13 && | 405 if (version() > QUIC_VERSION_13 && |
| 406 !fin_sent_ && !rst_sent_) { | 406 !fin_sent_ && !rst_sent_) { |
| 407 // For flow control accounting, we must tell the peer how many bytes we have | 407 // For flow control accounting, we must tell the peer how many bytes we have |
| 408 // written on this stream before termination. Done here if needed, using a | 408 // written on this stream before termination. Done here if needed, using a |
| 409 // RST frame. | 409 // RST frame. |
| 410 DVLOG(1) << ENDPOINT << "Sending RST in OnClose: " << id(); | 410 DVLOG(1) << ENDPOINT << "Sending RST in OnClose: " << id(); |
| 411 session_->SendRstStream(id(), QUIC_STREAM_NO_ERROR, stream_bytes_written_); | 411 session_->SendRstStream(id(), QUIC_RST_FLOW_CONTROL_ACCOUNTING, |
| 412 stream_bytes_written_); |
| 412 rst_sent_ = true; | 413 rst_sent_ = true; |
| 413 } | 414 } |
| 414 } | 415 } |
| 415 | 416 |
| 416 void ReliableQuicStream::OnWindowUpdateFrame( | 417 void ReliableQuicStream::OnWindowUpdateFrame( |
| 417 const QuicWindowUpdateFrame& frame) { | 418 const QuicWindowUpdateFrame& frame) { |
| 418 if (!flow_controller_.IsEnabled()) { | 419 if (!flow_controller_.IsEnabled()) { |
| 419 DLOG(DFATAL) << "Flow control not enabled! " << version(); | 420 DLOG(DFATAL) << "Flow control not enabled! " << version(); |
| 420 return; | 421 return; |
| 421 } | 422 } |
| 422 | 423 |
| 423 if (flow_controller_.UpdateSendWindowOffset(frame.byte_offset)) { | 424 if (flow_controller_.UpdateSendWindowOffset(frame.byte_offset)) { |
| 424 // We can write again! | 425 // We can write again! |
| 425 // TODO(rjshade): This does not respect priorities (e.g. multiple | 426 // TODO(rjshade): This does not respect priorities (e.g. multiple |
| 426 // outstanding POSTs are unblocked on arrival of | 427 // outstanding POSTs are unblocked on arrival of |
| 427 // SHLO with initial window). | 428 // SHLO with initial window). |
| 428 OnCanWrite(); | 429 OnCanWrite(); |
| 429 } | 430 } |
| 430 } | 431 } |
| 431 | 432 |
| 432 } // namespace net | 433 } // namespace net |
| OLD | NEW |