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 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
261 } | 261 } |
262 | 262 |
263 size_t QuicFramer::GetSerializedFrameLength( | 263 size_t QuicFramer::GetSerializedFrameLength( |
264 const QuicFrame& frame, | 264 const QuicFrame& frame, |
265 size_t free_bytes, | 265 size_t free_bytes, |
266 bool first_frame, | 266 bool first_frame, |
267 bool last_frame, | 267 bool last_frame, |
268 InFecGroup is_in_fec_group, | 268 InFecGroup is_in_fec_group, |
269 QuicPacketNumberLength packet_number_length) { | 269 QuicPacketNumberLength packet_number_length) { |
270 // Prevent a rare crash reported in b/19458523. | 270 // Prevent a rare crash reported in b/19458523. |
271 if (frame.stream_frame == nullptr) { | 271 if ((frame.type == STREAM_FRAME || frame.type == ACK_FRAME) && |
| 272 frame.stream_frame == nullptr) { |
272 LOG(DFATAL) << "Cannot compute the length of a null frame. " | 273 LOG(DFATAL) << "Cannot compute the length of a null frame. " |
273 << "type:" << frame.type << "free_bytes:" << free_bytes | 274 << "type:" << frame.type << "free_bytes:" << free_bytes |
274 << " first_frame:" << first_frame | 275 << " first_frame:" << first_frame |
275 << " last_frame:" << last_frame | 276 << " last_frame:" << last_frame |
276 << " is_in_fec:" << is_in_fec_group | 277 << " is_in_fec:" << is_in_fec_group |
277 << " seq num length:" << packet_number_length; | 278 << " seq num length:" << packet_number_length; |
278 set_error(QUIC_INTERNAL_ERROR); | 279 set_error(QUIC_INTERNAL_ERROR); |
279 visitor_->OnError(this); | 280 visitor_->OnError(this); |
280 return 0; | 281 return 0; |
281 } | 282 } |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
390 return nullptr; | 391 return nullptr; |
391 } | 392 } |
392 break; | 393 break; |
393 case WINDOW_UPDATE_FRAME: | 394 case WINDOW_UPDATE_FRAME: |
394 if (!AppendWindowUpdateFrame(*frame.window_update_frame, &writer)) { | 395 if (!AppendWindowUpdateFrame(*frame.window_update_frame, &writer)) { |
395 LOG(DFATAL) << "AppendWindowUpdateFrame failed"; | 396 LOG(DFATAL) << "AppendWindowUpdateFrame failed"; |
396 return nullptr; | 397 return nullptr; |
397 } | 398 } |
398 break; | 399 break; |
399 case BLOCKED_FRAME: | 400 case BLOCKED_FRAME: |
400 if (!AppendBlockedFrame(*frame.blocked_frame, &writer)) { | 401 if (!AppendBlockedFrame(frame.blocked_frame, &writer)) { |
401 LOG(DFATAL) << "AppendBlockedFrame failed"; | 402 LOG(DFATAL) << "AppendBlockedFrame failed"; |
402 return nullptr; | 403 return nullptr; |
403 } | 404 } |
404 break; | 405 break; |
405 default: | 406 default: |
406 RaiseError(QUIC_INVALID_FRAME_DATA); | 407 RaiseError(QUIC_INVALID_FRAME_DATA); |
407 LOG(DFATAL) << "QUIC_INVALID_FRAME_DATA"; | 408 LOG(DFATAL) << "QUIC_INVALID_FRAME_DATA"; |
408 return nullptr; | 409 return nullptr; |
409 } | 410 } |
410 ++i; | 411 ++i; |
(...skipping 1834 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2245 | 2246 |
2246 bool QuicFramer::RaiseError(QuicErrorCode error) { | 2247 bool QuicFramer::RaiseError(QuicErrorCode error) { |
2247 DVLOG(1) << "Error: " << QuicUtils::ErrorToString(error) | 2248 DVLOG(1) << "Error: " << QuicUtils::ErrorToString(error) |
2248 << " detail: " << detailed_error_; | 2249 << " detail: " << detailed_error_; |
2249 set_error(error); | 2250 set_error(error); |
2250 visitor_->OnError(this); | 2251 visitor_->OnError(this); |
2251 return false; | 2252 return false; |
2252 } | 2253 } |
2253 | 2254 |
2254 } // namespace net | 2255 } // namespace net |
OLD | NEW |