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" |
11 | 11 |
12 using base::StringPiece; | 12 using base::StringPiece; |
13 using std::string; | 13 using std::string; |
14 | 14 |
15 namespace net { | 15 namespace net { |
16 | 16 |
17 QuicSpdySession::QuicSpdySession(QuicConnection* connection, | 17 QuicSpdySession::QuicSpdySession(QuicConnection* connection, |
18 const QuicConfig& config) | 18 const QuicConfig& config) |
19 : QuicSession(connection, config), force_hol_blocking_(false) {} | 19 : QuicSession(connection, config), |
| 20 force_hol_blocking_(false), |
| 21 server_push_enabled_(false) {} |
20 | 22 |
21 QuicSpdySession::~QuicSpdySession() { | 23 QuicSpdySession::~QuicSpdySession() { |
22 // Set the streams' session pointers in closed and dynamic stream lists | 24 // Set the streams' session pointers in closed and dynamic stream lists |
23 // to null to avoid subsequent use of this session. | 25 // to null to avoid subsequent use of this session. |
24 for (auto* stream : *closed_streams()) { | 26 for (auto* stream : *closed_streams()) { |
25 static_cast<QuicSpdyStream*>(stream)->ClearSession(); | 27 static_cast<QuicSpdyStream*>(stream)->ClearSession(); |
26 } | 28 } |
27 for (auto const& kv : dynamic_streams()) { | 29 for (auto const& kv : dynamic_streams()) { |
28 static_cast<QuicSpdyStream*>(kv.second)->ClearSession(); | 30 static_cast<QuicSpdyStream*>(kv.second)->ClearSession(); |
29 } | 31 } |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
155 const QuicVersion version = connection()->version(); | 157 const QuicVersion version = connection()->version(); |
156 if (version > QUIC_VERSION_35 && config()->ForceHolBlocking(perspective())) { | 158 if (version > QUIC_VERSION_35 && config()->ForceHolBlocking(perspective())) { |
157 force_hol_blocking_ = true; | 159 force_hol_blocking_ = true; |
158 // Autotuning makes sure that the headers stream flow control does | 160 // Autotuning makes sure that the headers stream flow control does |
159 // not get in the way, and normal stream and connection level flow | 161 // not get in the way, and normal stream and connection level flow |
160 // control are active anyway. This is really only for the client | 162 // control are active anyway. This is really only for the client |
161 // side (and mainly there just in tests and toys), where | 163 // side (and mainly there just in tests and toys), where |
162 // autotuning and/or large buffers are not enabled by default. | 164 // autotuning and/or large buffers are not enabled by default. |
163 headers_stream_->flow_controller()->set_auto_tune_receive_window(true); | 165 headers_stream_->flow_controller()->set_auto_tune_receive_window(true); |
164 } | 166 } |
| 167 |
| 168 if (version > QUIC_VERSION_34) { |
| 169 server_push_enabled_ = FLAGS_quic_enable_server_push_by_default; |
| 170 } |
165 } | 171 } |
166 | 172 |
167 void QuicSpdySession::OnStreamFrameData(QuicStreamId stream_id, | 173 void QuicSpdySession::OnStreamFrameData(QuicStreamId stream_id, |
168 const char* data, | 174 const char* data, |
169 size_t len, | 175 size_t len, |
170 bool fin) { | 176 bool fin) { |
171 QuicSpdyStream* stream = GetSpdyDataStream(stream_id); | 177 QuicSpdyStream* stream = GetSpdyDataStream(stream_id); |
172 if (stream == nullptr) { | 178 if (stream == nullptr) { |
173 return; | 179 return; |
174 } | 180 } |
175 const QuicStreamOffset offset = | 181 const QuicStreamOffset offset = |
176 stream->flow_controller()->highest_received_byte_offset(); | 182 stream->flow_controller()->highest_received_byte_offset(); |
177 const QuicStreamFrame frame(stream_id, fin, offset, StringPiece(data, len)); | 183 const QuicStreamFrame frame(stream_id, fin, offset, StringPiece(data, len)); |
178 DVLOG(1) << "De-encapsulating DATA frame for stream " << stream_id | 184 DVLOG(1) << "De-encapsulating DATA frame for stream " << stream_id |
179 << " offset " << offset << " len " << len << " fin " << fin; | 185 << " offset " << offset << " len " << len << " fin " << fin; |
180 OnStreamFrame(frame); | 186 OnStreamFrame(frame); |
181 } | 187 } |
182 | 188 |
183 } // namespace net | 189 } // namespace net |
OLD | NEW |