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_flags.h" | 7 #include "net/quic/quic_flags.h" |
8 | 8 |
9 namespace net { | 9 namespace net { |
10 | 10 |
(...skipping 10 matching lines...) Expand all Loading... |
21 if (!FLAGS_enable_quic_fec || event != ENCRYPTION_FIRST_ESTABLISHED || | 21 if (!FLAGS_enable_quic_fec || event != ENCRYPTION_FIRST_ESTABLISHED || |
22 !config()->HasSendConnectionOptions() || | 22 !config()->HasSendConnectionOptions() || |
23 !ContainsQuicTag(config()->SendConnectionOptions(), kFHDR)) { | 23 !ContainsQuicTag(config()->SendConnectionOptions(), kFHDR)) { |
24 return; | 24 return; |
25 } | 25 } |
26 // kFHDR config maps to FEC protection always for headers stream. | 26 // kFHDR config maps to FEC protection always for headers stream. |
27 // TODO(jri): Add crypto stream in addition to headers for kHDR. | 27 // TODO(jri): Add crypto stream in addition to headers for kHDR. |
28 headers_stream()->set_fec_policy(FEC_PROTECT_ALWAYS); | 28 headers_stream()->set_fec_policy(FEC_PROTECT_ALWAYS); |
29 } | 29 } |
30 | 30 |
| 31 void QuicClientSessionBase::OnPromiseHeaders(QuicStreamId stream_id, |
| 32 StringPiece headers_data) { |
| 33 QuicSpdyStream* stream = GetSpdyDataStream(stream_id); |
| 34 if (!stream) { |
| 35 // It's quite possible to receive headers after a stream has been reset. |
| 36 return; |
| 37 } |
| 38 stream->OnPromiseHeaders(headers_data); |
| 39 } |
| 40 |
| 41 void QuicClientSessionBase::OnPromiseHeadersComplete( |
| 42 QuicStreamId stream_id, |
| 43 QuicStreamId promised_stream_id, |
| 44 size_t frame_len) { |
| 45 if (promised_stream_id != kInvalidStreamId && |
| 46 promised_stream_id <= largest_promised_stream_id_) { |
| 47 CloseConnectionWithDetails(QUIC_INVALID_STREAM_ID, |
| 48 "Received push stream id lesser or equal to the" |
| 49 " last accepted before"); |
| 50 return; |
| 51 } |
| 52 largest_promised_stream_id_ = promised_stream_id; |
| 53 |
| 54 QuicSpdyStream* stream = GetSpdyDataStream(stream_id); |
| 55 if (!stream) { |
| 56 // It's quite possible to receive headers after a stream has been reset. |
| 57 return; |
| 58 } |
| 59 stream->OnPromiseHeadersComplete(promised_stream_id, frame_len); |
| 60 } |
| 61 |
31 } // namespace net | 62 } // namespace net |
OLD | NEW |