| OLD | NEW |
| 1 // Copyright (c) 2015 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2015 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_spdy_session.h" | 5 #include "net/quic/core/quic_spdy_session.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "net/quic/core/quic_bug_tracker.h" | 9 #include "net/quic/core/quic_bug_tracker.h" |
| 10 #include "net/quic/core/quic_headers_stream.h" | 10 #include "net/quic/core/quic_headers_stream.h" |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 114 | 114 |
| 115 void QuicSpdySession::OnConfigNegotiated() { | 115 void QuicSpdySession::OnConfigNegotiated() { |
| 116 QuicSession::OnConfigNegotiated(); | 116 QuicSession::OnConfigNegotiated(); |
| 117 if (config()->HasClientSentConnectionOption(kDHDT, perspective())) { | 117 if (config()->HasClientSentConnectionOption(kDHDT, perspective())) { |
| 118 headers_stream_->DisableHpackDynamicTable(); | 118 headers_stream_->DisableHpackDynamicTable(); |
| 119 } | 119 } |
| 120 const QuicVersion version = connection()->version(); | 120 const QuicVersion version = connection()->version(); |
| 121 if (FLAGS_quic_enable_force_hol_blocking && version > QUIC_VERSION_35 && | 121 if (FLAGS_quic_enable_force_hol_blocking && version > QUIC_VERSION_35 && |
| 122 config()->ForceHolBlocking(perspective())) { | 122 config()->ForceHolBlocking(perspective())) { |
| 123 force_hol_blocking_ = true; | 123 force_hol_blocking_ = true; |
| 124 if (!FLAGS_quic_bugfix_fhol_writev_fin_only_v2) { | 124 // Since all streams are tunneled through the headers stream, it |
| 125 // Autotuning makes sure that the headers stream flow control does | 125 // is important that headers stream never flow control blocks. |
| 126 // not get in the way, and normal stream and connection level flow | 126 // Otherwise, busy-loop behaviour can ensue where data streams |
| 127 // control are active anyway. This is really only for the client | 127 // data try repeatedly to write data not realizing that the |
| 128 // side (and mainly there just in tests and toys), where | 128 // tunnel through the headers stream is blocked. |
| 129 // autotuning and/or large buffers are not enabled by default. | 129 headers_stream_->flow_controller()->UpdateReceiveWindowSize( |
| 130 headers_stream_->flow_controller()->set_auto_tune_receive_window(true); | 130 kStreamReceiveWindowLimit); |
| 131 } else { | 131 headers_stream_->flow_controller()->UpdateSendWindowOffset( |
| 132 // Since all streams are tunneled through the headers stream, it | 132 kStreamReceiveWindowLimit); |
| 133 // is important that headers stream never flow control blocks. | |
| 134 // Otherwise, busy-loop behaviour can ensue where data streams | |
| 135 // data try repeatedly to write data not realizing that the | |
| 136 // tunnel through the headers stream is blocked. | |
| 137 headers_stream_->flow_controller()->UpdateReceiveWindowSize( | |
| 138 kStreamReceiveWindowLimit); | |
| 139 headers_stream_->flow_controller()->UpdateSendWindowOffset( | |
| 140 kStreamReceiveWindowLimit); | |
| 141 } | |
| 142 } | 133 } |
| 143 | 134 |
| 144 if (version > QUIC_VERSION_34) { | 135 if (version > QUIC_VERSION_34) { |
| 145 server_push_enabled_ = FLAGS_quic_enable_server_push_by_default; | 136 server_push_enabled_ = FLAGS_quic_enable_server_push_by_default; |
| 146 } | 137 } |
| 147 } | 138 } |
| 148 | 139 |
| 149 void QuicSpdySession::OnStreamFrameData(QuicStreamId stream_id, | 140 void QuicSpdySession::OnStreamFrameData(QuicStreamId stream_id, |
| 150 const char* data, | 141 const char* data, |
| 151 size_t len, | 142 size_t len, |
| 152 bool fin) { | 143 bool fin) { |
| 153 QuicSpdyStream* stream = GetSpdyDataStream(stream_id); | 144 QuicSpdyStream* stream = GetSpdyDataStream(stream_id); |
| 154 if (stream == nullptr) { | 145 if (stream == nullptr) { |
| 155 return; | 146 return; |
| 156 } | 147 } |
| 157 const QuicStreamOffset offset = | 148 const QuicStreamOffset offset = |
| 158 stream->flow_controller()->highest_received_byte_offset(); | 149 stream->flow_controller()->highest_received_byte_offset(); |
| 159 const QuicStreamFrame frame(stream_id, fin, offset, StringPiece(data, len)); | 150 const QuicStreamFrame frame(stream_id, fin, offset, StringPiece(data, len)); |
| 160 DVLOG(1) << "De-encapsulating DATA frame for stream " << stream_id | 151 DVLOG(1) << "De-encapsulating DATA frame for stream " << stream_id |
| 161 << " offset " << offset << " len " << len << " fin " << fin; | 152 << " offset " << offset << " len " << len << " fin " << fin; |
| 162 OnStreamFrame(frame); | 153 OnStreamFrame(frame); |
| 163 } | 154 } |
| 164 | 155 |
| 165 bool QuicSpdySession::ShouldReleaseHeadersStreamSequencerBuffer() { | 156 bool QuicSpdySession::ShouldReleaseHeadersStreamSequencerBuffer() { |
| 166 return false; | 157 return false; |
| 167 } | 158 } |
| 168 | 159 |
| 169 } // namespace net | 160 } // namespace net |
| OLD | NEW |