| 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_framer.h" | 5 #include "net/quic/quic_framer.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
| 10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
| (...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 297 } | 297 } |
| 298 bool can_truncate = | 298 bool can_truncate = |
| 299 frame.type == ACK_FRAME && | 299 frame.type == ACK_FRAME && |
| 300 free_bytes >= GetMinAckFrameSize(PACKET_6BYTE_PACKET_NUMBER); | 300 free_bytes >= GetMinAckFrameSize(PACKET_6BYTE_PACKET_NUMBER); |
| 301 if (can_truncate) { | 301 if (can_truncate) { |
| 302 // Truncate the frame so the packet will not exceed kMaxPacketSize. | 302 // Truncate the frame so the packet will not exceed kMaxPacketSize. |
| 303 // Note that we may not use every byte of the writer in this case. | 303 // Note that we may not use every byte of the writer in this case. |
| 304 DVLOG(1) << "Truncating large frame, free bytes: " << free_bytes; | 304 DVLOG(1) << "Truncating large frame, free bytes: " << free_bytes; |
| 305 return free_bytes; | 305 return free_bytes; |
| 306 } | 306 } |
| 307 if (!FLAGS_quic_allow_oversized_packets_for_test) { | 307 return 0; |
| 308 return 0; | |
| 309 } | |
| 310 LOG(DFATAL) << "Packet size too small to fit frame."; | |
| 311 return frame_len; | |
| 312 } | 308 } |
| 313 | 309 |
| 314 QuicFramer::AckFrameInfo::AckFrameInfo() : max_delta(0) {} | 310 QuicFramer::AckFrameInfo::AckFrameInfo() : max_delta(0) {} |
| 315 | 311 |
| 316 QuicFramer::AckFrameInfo::~AckFrameInfo() {} | 312 QuicFramer::AckFrameInfo::~AckFrameInfo() {} |
| 317 | 313 |
| 318 // static | 314 // static |
| 319 QuicPacketEntropyHash QuicFramer::GetPacketEntropyHash( | 315 QuicPacketEntropyHash QuicFramer::GetPacketEntropyHash( |
| 320 const QuicPacketHeader& header) { | 316 const QuicPacketHeader& header) { |
| 321 return header.entropy_flag << (header.packet_number % 8); | 317 return header.entropy_flag << (header.packet_number % 8); |
| (...skipping 1874 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2196 | 2192 |
| 2197 bool QuicFramer::RaiseError(QuicErrorCode error) { | 2193 bool QuicFramer::RaiseError(QuicErrorCode error) { |
| 2198 DVLOG(1) << "Error: " << QuicUtils::ErrorToString(error) | 2194 DVLOG(1) << "Error: " << QuicUtils::ErrorToString(error) |
| 2199 << " detail: " << detailed_error_; | 2195 << " detail: " << detailed_error_; |
| 2200 set_error(error); | 2196 set_error(error); |
| 2201 visitor_->OnError(this); | 2197 visitor_->OnError(this); |
| 2202 return false; | 2198 return false; |
| 2203 } | 2199 } |
| 2204 | 2200 |
| 2205 } // namespace net | 2201 } // namespace net |
| OLD | NEW |