Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(307)

Side by Side Diff: net/quic/core/quic_stream.cc

Issue 2820263005: In QUIC version >= 38, enables random padding of size [1, 256] (Closed)
Patch Set: Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
66 perspective_(session_->perspective()), 66 perspective_(session_->perspective()),
67 flow_controller_(session_->connection(), 67 flow_controller_(session_->connection(),
68 id_, 68 id_,
69 perspective_, 69 perspective_,
70 GetReceivedFlowControlWindow(session), 70 GetReceivedFlowControlWindow(session),
71 GetInitialStreamFlowControlWindowToSend(session), 71 GetInitialStreamFlowControlWindowToSend(session),
72 session_->flow_controller()->auto_tune_receive_window(), 72 session_->flow_controller()->auto_tune_receive_window(),
73 session_->flow_controller()), 73 session_->flow_controller()),
74 connection_flow_controller_(session_->flow_controller()), 74 connection_flow_controller_(session_->flow_controller()),
75 stream_contributes_to_connection_flow_control_(true), 75 stream_contributes_to_connection_flow_control_(true),
76 busy_counter_(0) { 76 busy_counter_(0),
77 add_random_padding_after_fin_(false) {
77 SetFromConfig(); 78 SetFromConfig();
78 } 79 }
79 80
80 QuicStream::~QuicStream() {} 81 QuicStream::~QuicStream() {}
81 82
82 void QuicStream::SetFromConfig() {} 83 void QuicStream::SetFromConfig() {}
83 84
84 void QuicStream::OnStreamFrame(const QuicStreamFrame& frame) { 85 void QuicStream::OnStreamFrame(const QuicStreamFrame& frame) {
85 DCHECK_EQ(frame.stream_id, id_); 86 DCHECK_EQ(frame.stream_id, id_);
86 87
(...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after
349 busy_counter_ = 0; 350 busy_counter_ = 0;
350 } 351 }
351 return consumed_data; 352 return consumed_data;
352 } 353 }
353 354
354 QuicConsumedData QuicStream::WritevDataInner( 355 QuicConsumedData QuicStream::WritevDataInner(
355 QuicIOVector iov, 356 QuicIOVector iov,
356 QuicStreamOffset offset, 357 QuicStreamOffset offset,
357 bool fin, 358 bool fin,
358 QuicReferenceCountedPointer<QuicAckListenerInterface> ack_listener) { 359 QuicReferenceCountedPointer<QuicAckListenerInterface> ack_listener) {
359 return session()->WritevData(this, id(), iov, offset, fin, 360 StreamSendingState state = fin ? FIN : NO_FIN;
361 if (fin && add_random_padding_after_fin_) {
362 state = FIN_AND_PADDING;
363 }
364 return session()->WritevData(this, id(), iov, offset, state,
360 std::move(ack_listener)); 365 std::move(ack_listener));
361 } 366 }
362 367
363 void QuicStream::CloseReadSide() { 368 void QuicStream::CloseReadSide() {
364 if (read_side_closed_) { 369 if (read_side_closed_) {
365 return; 370 return;
366 } 371 }
367 QUIC_DLOG(INFO) << ENDPOINT << "Done reading from stream " << id(); 372 QUIC_DLOG(INFO) << ENDPOINT << "Done reading from stream " << id();
368 373
369 read_side_closed_ = true; 374 read_side_closed_ = true;
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
476 connection_flow_controller_->AddBytesConsumed(bytes); 481 connection_flow_controller_->AddBytesConsumed(bytes);
477 } 482 }
478 } 483 }
479 484
480 void QuicStream::UpdateSendWindowOffset(QuicStreamOffset new_window) { 485 void QuicStream::UpdateSendWindowOffset(QuicStreamOffset new_window) {
481 if (flow_controller_.UpdateSendWindowOffset(new_window)) { 486 if (flow_controller_.UpdateSendWindowOffset(new_window)) {
482 OnCanWrite(); 487 OnCanWrite();
483 } 488 }
484 } 489 }
485 490
491 void QuicStream::AddRandomPaddingAfterFin() {
492 add_random_padding_after_fin_ = true;
493 }
494
486 } // namespace net 495 } // namespace net
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698