| 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/core/quic_framer.h" | 5 #include "net/quic/core/quic_framer.h" |
| 6 | 6 |
| 7 #include <cstdint> | 7 #include <cstdint> |
| 8 #include <memory> | 8 #include <memory> |
| 9 | 9 |
| 10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
| (...skipping 1298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1309 | 1309 |
| 1310 bool QuicFramer::ProcessStopWaitingFrame(QuicDataReader* reader, | 1310 bool QuicFramer::ProcessStopWaitingFrame(QuicDataReader* reader, |
| 1311 const QuicPacketHeader& header, | 1311 const QuicPacketHeader& header, |
| 1312 QuicStopWaitingFrame* stop_waiting) { | 1312 QuicStopWaitingFrame* stop_waiting) { |
| 1313 QuicPacketNumber least_unacked_delta = 0; | 1313 QuicPacketNumber least_unacked_delta = 0; |
| 1314 if (!reader->ReadBytesToUInt64(header.public_header.packet_number_length, | 1314 if (!reader->ReadBytesToUInt64(header.public_header.packet_number_length, |
| 1315 &least_unacked_delta)) { | 1315 &least_unacked_delta)) { |
| 1316 set_detailed_error("Unable to read least unacked delta."); | 1316 set_detailed_error("Unable to read least unacked delta."); |
| 1317 return false; | 1317 return false; |
| 1318 } | 1318 } |
| 1319 DCHECK_GE(header.packet_number, least_unacked_delta); | 1319 if (header.packet_number < least_unacked_delta) { |
| 1320 set_detailed_error("Invalid unacked delta."); |
| 1321 return false; |
| 1322 } |
| 1320 stop_waiting->least_unacked = header.packet_number - least_unacked_delta; | 1323 stop_waiting->least_unacked = header.packet_number - least_unacked_delta; |
| 1321 | 1324 |
| 1322 return true; | 1325 return true; |
| 1323 } | 1326 } |
| 1324 | 1327 |
| 1325 bool QuicFramer::ProcessRstStreamFrame(QuicDataReader* reader, | 1328 bool QuicFramer::ProcessRstStreamFrame(QuicDataReader* reader, |
| 1326 QuicRstStreamFrame* frame) { | 1329 QuicRstStreamFrame* frame) { |
| 1327 if (!reader->ReadUInt32(&frame->stream_id)) { | 1330 if (!reader->ReadUInt32(&frame->stream_id)) { |
| 1328 set_detailed_error("Unable to read stream_id."); | 1331 set_detailed_error("Unable to read stream_id."); |
| 1329 return false; | 1332 return false; |
| (...skipping 820 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2150 set_error(error); | 2153 set_error(error); |
| 2151 visitor_->OnError(this); | 2154 visitor_->OnError(this); |
| 2152 return false; | 2155 return false; |
| 2153 } | 2156 } |
| 2154 | 2157 |
| 2155 Endianness QuicFramer::endianness() const { | 2158 Endianness QuicFramer::endianness() const { |
| 2156 return quic_version_ > QUIC_VERSION_38 ? NETWORK_BYTE_ORDER : HOST_BYTE_ORDER; | 2159 return quic_version_ > QUIC_VERSION_38 ? NETWORK_BYTE_ORDER : HOST_BYTE_ORDER; |
| 2157 } | 2160 } |
| 2158 | 2161 |
| 2159 } // namespace net | 2162 } // namespace net |
| OLD | NEW |