| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/quic_client_session_base.h" | 5 #include "net/quic/quic_client_session_base.h" |
| 6 | 6 |
| 7 #include "net/quic/quic_client_promised_info.h" | 7 #include "net/quic/quic_client_promised_info.h" |
| 8 #include "net/quic/quic_flags.h" | 8 #include "net/quic/quic_flags.h" |
| 9 #include "net/quic/spdy_utils.h" | 9 #include "net/quic/spdy_utils.h" |
| 10 | 10 |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 QuicClientSessionBase::~QuicClientSessionBase() { | 21 QuicClientSessionBase::~QuicClientSessionBase() { |
| 22 // all promised streams for this session | 22 // all promised streams for this session |
| 23 for (auto& it : promised_by_id_) { | 23 for (auto& it : promised_by_id_) { |
| 24 DVLOG(1) << "erase stream " << it.first << " url " << it.second->url(); | 24 DVLOG(1) << "erase stream " << it.first << " url " << it.second->url(); |
| 25 push_promise_index_->promised_by_url()->erase(it.second->url()); | 25 push_promise_index_->promised_by_url()->erase(it.second->url()); |
| 26 } | 26 } |
| 27 } | 27 } |
| 28 | 28 |
| 29 void QuicClientSessionBase::OnCryptoHandshakeEvent(CryptoHandshakeEvent event) { | 29 void QuicClientSessionBase::OnCryptoHandshakeEvent(CryptoHandshakeEvent event) { |
| 30 QuicSession::OnCryptoHandshakeEvent(event); | 30 QuicSession::OnCryptoHandshakeEvent(event); |
| 31 // Set FEC policy for streams immediately after sending CHLO and before any | |
| 32 // more data is sent. | |
| 33 if (!FLAGS_enable_quic_fec || event != ENCRYPTION_FIRST_ESTABLISHED || | |
| 34 !config()->HasSendConnectionOptions() || | |
| 35 !ContainsQuicTag(config()->SendConnectionOptions(), kFHDR)) { | |
| 36 return; | |
| 37 } | |
| 38 // kFHDR config maps to FEC protection always for headers stream. | |
| 39 // TODO(jri): Add crypto stream in addition to headers for kHDR. | |
| 40 headers_stream()->set_fec_policy(FEC_PROTECT_ALWAYS); | |
| 41 } | 31 } |
| 42 | 32 |
| 43 void QuicClientSessionBase::OnPromiseHeaders(QuicStreamId stream_id, | 33 void QuicClientSessionBase::OnPromiseHeaders(QuicStreamId stream_id, |
| 44 StringPiece headers_data) { | 34 StringPiece headers_data) { |
| 45 QuicSpdyStream* stream = GetSpdyDataStream(stream_id); | 35 QuicSpdyStream* stream = GetSpdyDataStream(stream_id); |
| 46 if (!stream) { | 36 if (!stream) { |
| 47 // It's quite possible to receive headers after a stream has been reset. | 37 // It's quite possible to receive headers after a stream has been reset. |
| 48 return; | 38 return; |
| 49 } | 39 } |
| 50 stream->OnPromiseHeaders(headers_data); | 40 stream->OnPromiseHeaders(headers_data); |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 173 void QuicClientSessionBase::ResetPromised(QuicStreamId id, | 163 void QuicClientSessionBase::ResetPromised(QuicStreamId id, |
| 174 QuicRstStreamErrorCode error_code) { | 164 QuicRstStreamErrorCode error_code) { |
| 175 SendRstStream(id, error_code, 0); | 165 SendRstStream(id, error_code, 0); |
| 176 if (!IsOpenStream(id)) { | 166 if (!IsOpenStream(id)) { |
| 177 MaybeIncreaseLargestPeerStreamId(id); | 167 MaybeIncreaseLargestPeerStreamId(id); |
| 178 InsertLocallyClosedStreamsHighestOffset(id, 0); | 168 InsertLocallyClosedStreamsHighestOffset(id, 0); |
| 179 } | 169 } |
| 180 } | 170 } |
| 181 | 171 |
| 182 } // namespace net | 172 } // namespace net |
| OLD | NEW |