| 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/core/quic_stream.h" | 5 #include "net/quic/core/quic_stream.h" |
| 6 | 6 |
| 7 #include "net/quic/core/quic_flow_controller.h" | 7 #include "net/quic/core/quic_flow_controller.h" |
| 8 #include "net/quic/core/quic_session.h" | 8 #include "net/quic/core/quic_session.h" |
| 9 #include "net/quic/platform/api/quic_bug_tracker.h" | 9 #include "net/quic/platform/api/quic_bug_tracker.h" |
| 10 #include "net/quic/platform/api/quic_logging.h" | 10 #include "net/quic/platform/api/quic_logging.h" |
| (...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 268 session_->MarkConnectionLevelWriteBlocked(id()); | 268 session_->MarkConnectionLevelWriteBlocked(id()); |
| 269 } | 269 } |
| 270 } | 270 } |
| 271 | 271 |
| 272 QuicConsumedData QuicStream::WritevData( | 272 QuicConsumedData QuicStream::WritevData( |
| 273 const struct iovec* iov, | 273 const struct iovec* iov, |
| 274 int iov_count, | 274 int iov_count, |
| 275 bool fin, | 275 bool fin, |
| 276 QuicReferenceCountedPointer<QuicAckListenerInterface> ack_listener) { | 276 QuicReferenceCountedPointer<QuicAckListenerInterface> ack_listener) { |
| 277 if (write_side_closed_) { | 277 if (write_side_closed_) { |
| 278 QUIC_DLOG(ERROR) << ENDPOINT | 278 QUIC_DLOG(ERROR) << ENDPOINT << "Stream " << id() |
| 279 << "Attempt to write when the write side is closed"; | 279 << "attempting to write when the write side is closed"; |
| 280 return QuicConsumedData(0, false); | 280 return QuicConsumedData(0, false); |
| 281 } | 281 } |
| 282 | 282 |
| 283 // How much data was provided. | 283 // How much data was provided. |
| 284 size_t write_length = 0; | 284 size_t write_length = 0; |
| 285 if (iov != nullptr) { | 285 if (iov != nullptr) { |
| 286 for (int i = 0; i < iov_count; ++i) { | 286 for (int i = 0; i < iov_count; ++i) { |
| 287 write_length += iov[i].iov_len; | 287 write_length += iov[i].iov_len; |
| 288 } | 288 } |
| 289 } | 289 } |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 366 void QuicStream::CloseReadSide() { | 366 void QuicStream::CloseReadSide() { |
| 367 if (read_side_closed_) { | 367 if (read_side_closed_) { |
| 368 return; | 368 return; |
| 369 } | 369 } |
| 370 QUIC_DLOG(INFO) << ENDPOINT << "Done reading from stream " << id(); | 370 QUIC_DLOG(INFO) << ENDPOINT << "Done reading from stream " << id(); |
| 371 | 371 |
| 372 read_side_closed_ = true; | 372 read_side_closed_ = true; |
| 373 sequencer_.ReleaseBuffer(); | 373 sequencer_.ReleaseBuffer(); |
| 374 | 374 |
| 375 if (write_side_closed_) { | 375 if (write_side_closed_) { |
| 376 QUIC_DLOG(INFO) << ENDPOINT << "Closing stream: " << id(); | 376 QUIC_DLOG(INFO) << ENDPOINT << "Closing stream " << id(); |
| 377 session_->CloseStream(id()); | 377 session_->CloseStream(id()); |
| 378 } | 378 } |
| 379 } | 379 } |
| 380 | 380 |
| 381 void QuicStream::CloseWriteSide() { | 381 void QuicStream::CloseWriteSide() { |
| 382 if (write_side_closed_) { | 382 if (write_side_closed_) { |
| 383 return; | 383 return; |
| 384 } | 384 } |
| 385 QUIC_DLOG(INFO) << ENDPOINT << "Done writing to stream " << id(); | 385 QUIC_DLOG(INFO) << ENDPOINT << "Done writing to stream " << id(); |
| 386 | 386 |
| 387 write_side_closed_ = true; | 387 write_side_closed_ = true; |
| 388 if (read_side_closed_) { | 388 if (read_side_closed_) { |
| 389 QUIC_DLOG(INFO) << ENDPOINT << "Closing stream: " << id(); | 389 QUIC_DLOG(INFO) << ENDPOINT << "Closing stream " << id(); |
| 390 session_->CloseStream(id()); | 390 session_->CloseStream(id()); |
| 391 } | 391 } |
| 392 } | 392 } |
| 393 | 393 |
| 394 bool QuicStream::HasBufferedData() const { | 394 bool QuicStream::HasBufferedData() const { |
| 395 return !queued_data_.empty(); | 395 return !queued_data_.empty(); |
| 396 } | 396 } |
| 397 | 397 |
| 398 QuicVersion QuicStream::version() const { | 398 QuicVersion QuicStream::version() const { |
| 399 return session_->connection()->version(); | 399 return session_->connection()->version(); |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 480 } | 480 } |
| 481 } | 481 } |
| 482 | 482 |
| 483 void QuicStream::UpdateSendWindowOffset(QuicStreamOffset new_window) { | 483 void QuicStream::UpdateSendWindowOffset(QuicStreamOffset new_window) { |
| 484 if (flow_controller_.UpdateSendWindowOffset(new_window)) { | 484 if (flow_controller_.UpdateSendWindowOffset(new_window)) { |
| 485 OnCanWrite(); | 485 OnCanWrite(); |
| 486 } | 486 } |
| 487 } | 487 } |
| 488 | 488 |
| 489 } // namespace net | 489 } // namespace net |
| OLD | NEW |