| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_session.h" | 5 #include "net/quic/quic_session.h" |
| 6 | 6 |
| 7 #include "base/stl_util.h" | 7 #include "base/stl_util.h" |
| 8 #include "base/strings/string_number_conversions.h" | 8 #include "base/strings/string_number_conversions.h" |
| 9 #include "base/strings/stringprintf.h" | 9 #include "base/strings/stringprintf.h" |
| 10 #include "net/quic/crypto/proof_verifier.h" | 10 #include "net/quic/crypto/proof_verifier.h" |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 | 76 |
| 77 void QuicSession::OnStreamFrame(const QuicStreamFrame& frame) { | 77 void QuicSession::OnStreamFrame(const QuicStreamFrame& frame) { |
| 78 // TODO(rch) deal with the error case of stream id 0. | 78 // TODO(rch) deal with the error case of stream id 0. |
| 79 QuicStreamId stream_id = frame.stream_id; | 79 QuicStreamId stream_id = frame.stream_id; |
| 80 ReliableQuicStream* stream = GetOrCreateStream(stream_id); | 80 ReliableQuicStream* stream = GetOrCreateStream(stream_id); |
| 81 if (!stream) { | 81 if (!stream) { |
| 82 // The stream no longer exists, but we may still be interested in the | 82 // The stream no longer exists, but we may still be interested in the |
| 83 // final stream byte offset sent by the peer. A frame with a FIN can give | 83 // final stream byte offset sent by the peer. A frame with a FIN can give |
| 84 // us this offset. | 84 // us this offset. |
| 85 if (frame.fin) { | 85 if (frame.fin) { |
| 86 QuicStreamOffset final_byte_offset = frame.offset + frame.frame_length; | 86 QuicStreamOffset final_byte_offset = frame.offset + frame.data_length; |
| 87 UpdateFlowControlOnFinalReceivedByteOffset(stream_id, final_byte_offset); | 87 UpdateFlowControlOnFinalReceivedByteOffset(stream_id, final_byte_offset); |
| 88 } | 88 } |
| 89 return; | 89 return; |
| 90 } | 90 } |
| 91 stream->OnStreamFrame(frame); | 91 stream->OnStreamFrame(frame); |
| 92 } | 92 } |
| 93 | 93 |
| 94 void QuicSession::OnRstStream(const QuicRstStreamFrame& frame) { | 94 void QuicSession::OnRstStream(const QuicRstStreamFrame& frame) { |
| 95 if (ContainsKey(static_stream_map_, frame.stream_id)) { | 95 if (ContainsKey(static_stream_map_, frame.stream_id)) { |
| 96 connection()->CloseConnection( | 96 connection()->CloseConnection( |
| (...skipping 709 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 806 | 806 |
| 807 size_t QuicSession::MaxAvailableStreams() const { | 807 size_t QuicSession::MaxAvailableStreams() const { |
| 808 return max_open_incoming_streams_ * kMaxAvailableStreamsMultiplier; | 808 return max_open_incoming_streams_ * kMaxAvailableStreamsMultiplier; |
| 809 } | 809 } |
| 810 | 810 |
| 811 bool QuicSession::IsIncomingStream(QuicStreamId id) const { | 811 bool QuicSession::IsIncomingStream(QuicStreamId id) const { |
| 812 return id % 2 != next_outgoing_stream_id_ % 2; | 812 return id % 2 != next_outgoing_stream_id_ % 2; |
| 813 } | 813 } |
| 814 | 814 |
| 815 } // namespace net | 815 } // namespace net |
| OLD | NEW |