| 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 62 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 73   largest_promised_stream_id_ = promised_stream_id; | 73   largest_promised_stream_id_ = promised_stream_id; | 
| 74 | 74 | 
| 75   QuicSpdyStream* stream = GetSpdyDataStream(stream_id); | 75   QuicSpdyStream* stream = GetSpdyDataStream(stream_id); | 
| 76   if (!stream) { | 76   if (!stream) { | 
| 77     // It's quite possible to receive headers after a stream has been reset. | 77     // It's quite possible to receive headers after a stream has been reset. | 
| 78     return; | 78     return; | 
| 79   } | 79   } | 
| 80   stream->OnPromiseHeadersComplete(promised_stream_id, frame_len); | 80   stream->OnPromiseHeadersComplete(promised_stream_id, frame_len); | 
| 81 } | 81 } | 
| 82 | 82 | 
|  | 83 void QuicClientSessionBase::OnPromiseHeaderList( | 
|  | 84     QuicStreamId stream_id, | 
|  | 85     QuicStreamId promised_stream_id, | 
|  | 86     size_t frame_len, | 
|  | 87     const QuicHeaderList& header_list) { | 
|  | 88   if (promised_stream_id != kInvalidStreamId && | 
|  | 89       promised_stream_id <= largest_promised_stream_id_) { | 
|  | 90     connection()->CloseConnection( | 
|  | 91         QUIC_INVALID_STREAM_ID, | 
|  | 92         "Received push stream id lesser or equal to the" | 
|  | 93         " last accepted before", | 
|  | 94         ConnectionCloseBehavior::SEND_CONNECTION_CLOSE_PACKET); | 
|  | 95     return; | 
|  | 96   } | 
|  | 97   largest_promised_stream_id_ = promised_stream_id; | 
|  | 98 | 
|  | 99   QuicSpdyStream* stream = GetSpdyDataStream(stream_id); | 
|  | 100   if (!stream) { | 
|  | 101     // It's quite possible to receive headers after a stream has been reset. | 
|  | 102     return; | 
|  | 103   } | 
|  | 104   stream->OnPromiseHeaderList(promised_stream_id, frame_len, header_list); | 
|  | 105 } | 
|  | 106 | 
| 83 void QuicClientSessionBase::HandlePromised(QuicStreamId /* associated_id */, | 107 void QuicClientSessionBase::HandlePromised(QuicStreamId /* associated_id */, | 
| 84                                            QuicStreamId id, | 108                                            QuicStreamId id, | 
| 85                                            const SpdyHeaderBlock& headers) { | 109                                            const SpdyHeaderBlock& headers) { | 
| 86   // Due to pathalogical packet re-ordering, it is possible that | 110   // Due to pathalogical packet re-ordering, it is possible that | 
| 87   // frames for the promised stream have already arrived, and the | 111   // frames for the promised stream have already arrived, and the | 
| 88   // promised stream could be active or closed. | 112   // promised stream could be active or closed. | 
| 89   if (IsClosedStream(id)) { | 113   if (IsClosedStream(id)) { | 
| 90     // There was a RST on the data stream already, perhaps | 114     // There was a RST on the data stream already, perhaps | 
| 91     // QUIC_REFUSED_STREAM? | 115     // QUIC_REFUSED_STREAM? | 
| 92     DVLOG(1) << "Promise ignored for stream " << id | 116     DVLOG(1) << "Promise ignored for stream " << id | 
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 167 void QuicClientSessionBase::ResetPromised(QuicStreamId id, | 191 void QuicClientSessionBase::ResetPromised(QuicStreamId id, | 
| 168                                           QuicRstStreamErrorCode error_code) { | 192                                           QuicRstStreamErrorCode error_code) { | 
| 169   SendRstStream(id, error_code, 0); | 193   SendRstStream(id, error_code, 0); | 
| 170   if (!IsOpenStream(id)) { | 194   if (!IsOpenStream(id)) { | 
| 171     MaybeIncreaseLargestPeerStreamId(id); | 195     MaybeIncreaseLargestPeerStreamId(id); | 
| 172     InsertLocallyClosedStreamsHighestOffset(id, 0); | 196     InsertLocallyClosedStreamsHighestOffset(id, 0); | 
| 173   } | 197   } | 
| 174 } | 198 } | 
| 175 | 199 | 
| 176 }  // namespace net | 200 }  // namespace net | 
| OLD | NEW | 
|---|