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_flags.h" | 9 #include "net/quic/quic_flags.h" |
10 #include "net/quic/quic_flow_controller.h" | 10 #include "net/quic/quic_flow_controller.h" |
(...skipping 334 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
345 if (!stream_contributes_to_connection_flow_control_) { | 345 if (!stream_contributes_to_connection_flow_control_) { |
346 return; | 346 return; |
347 } | 347 } |
348 connection_flow_controller_->MaybeSendBlocked(); | 348 connection_flow_controller_->MaybeSendBlocked(); |
349 // If the stream is blocked by connection-level flow control but not by | 349 // If the stream is blocked by connection-level flow control but not by |
350 // stream-level flow control, add the stream to the write blocked list so that | 350 // stream-level flow control, add the stream to the write blocked list so that |
351 // the stream will be given a chance to write when a connection-level | 351 // the stream will be given a chance to write when a connection-level |
352 // WINDOW_UPDATE arrives. | 352 // WINDOW_UPDATE arrives. |
353 if (connection_flow_controller_->IsBlocked() && | 353 if (connection_flow_controller_->IsBlocked() && |
354 !flow_controller_.IsBlocked()) { | 354 !flow_controller_.IsBlocked()) { |
355 session_->MarkWriteBlocked(id(), EffectivePriority()); | 355 session_->MarkConnectionLevelWriteBlocked(id(), EffectivePriority()); |
356 } | 356 } |
357 } | 357 } |
358 | 358 |
359 QuicConsumedData ReliableQuicStream::WritevData( | 359 QuicConsumedData ReliableQuicStream::WritevData( |
360 const struct iovec* iov, | 360 const struct iovec* iov, |
361 int iov_count, | 361 int iov_count, |
362 bool fin, | 362 bool fin, |
363 QuicAckNotifier::DelegateInterface* ack_notifier_delegate) { | 363 QuicAckNotifier::DelegateInterface* ack_notifier_delegate) { |
364 if (write_side_closed_) { | 364 if (write_side_closed_) { |
365 DLOG(ERROR) << ENDPOINT << "Attempt to write when the write side is closed"; | 365 DLOG(ERROR) << ENDPOINT << "Attempt to write when the write side is closed"; |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
404 if (!fin_with_zero_data) { | 404 if (!fin_with_zero_data) { |
405 MaybeSendBlocked(); | 405 MaybeSendBlocked(); |
406 } | 406 } |
407 if (fin && consumed_data.fin_consumed) { | 407 if (fin && consumed_data.fin_consumed) { |
408 fin_sent_ = true; | 408 fin_sent_ = true; |
409 if (fin_received_) { | 409 if (fin_received_) { |
410 session_->StreamDraining(id_); | 410 session_->StreamDraining(id_); |
411 } | 411 } |
412 CloseWriteSide(); | 412 CloseWriteSide(); |
413 } else if (fin && !consumed_data.fin_consumed) { | 413 } else if (fin && !consumed_data.fin_consumed) { |
414 session_->MarkWriteBlocked(id(), EffectivePriority()); | 414 session_->MarkConnectionLevelWriteBlocked(id(), EffectivePriority()); |
415 } | 415 } |
416 } else { | 416 } else { |
417 session_->MarkWriteBlocked(id(), EffectivePriority()); | 417 session_->MarkConnectionLevelWriteBlocked(id(), EffectivePriority()); |
418 } | 418 } |
419 return consumed_data; | 419 return consumed_data; |
420 } | 420 } |
421 | 421 |
422 FecProtection ReliableQuicStream::GetFecProtection() { | 422 FecProtection ReliableQuicStream::GetFecProtection() { |
423 return fec_policy_ == FEC_PROTECT_ALWAYS ? MUST_FEC_PROTECT : MAY_FEC_PROTECT; | 423 return fec_policy_ == FEC_PROTECT_ALWAYS ? MUST_FEC_PROTECT : MAY_FEC_PROTECT; |
424 } | 424 } |
425 | 425 |
426 void ReliableQuicStream::CloseReadSide() { | 426 void ReliableQuicStream::CloseReadSide() { |
427 if (read_side_closed_) { | 427 if (read_side_closed_) { |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
530 } | 530 } |
531 } | 531 } |
532 | 532 |
533 void ReliableQuicStream::UpdateSendWindowOffset(QuicStreamOffset new_window) { | 533 void ReliableQuicStream::UpdateSendWindowOffset(QuicStreamOffset new_window) { |
534 if (flow_controller_.UpdateSendWindowOffset(new_window)) { | 534 if (flow_controller_.UpdateSendWindowOffset(new_window)) { |
535 OnCanWrite(); | 535 OnCanWrite(); |
536 } | 536 } |
537 } | 537 } |
538 | 538 |
539 } // namespace net | 539 } // namespace net |
OLD | NEW |