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_packet_creator.h" | 5 #include "net/quic/quic_packet_creator.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 | 8 |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 445 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
456 // packet sizes are properly used. | 456 // packet sizes are properly used. |
457 scoped_ptr<char[]> large_buffer; | 457 scoped_ptr<char[]> large_buffer; |
458 if (packet_size_ <= kMaxPacketSize) { | 458 if (packet_size_ <= kMaxPacketSize) { |
459 packet.reset( | 459 packet.reset( |
460 framer_->BuildDataPacket(header, queued_frames_, buffer, packet_size_)); | 460 framer_->BuildDataPacket(header, queued_frames_, buffer, packet_size_)); |
461 } else { | 461 } else { |
462 large_buffer.reset(new char[packet_size_]); | 462 large_buffer.reset(new char[packet_size_]); |
463 packet.reset(framer_->BuildDataPacket(header, queued_frames_, | 463 packet.reset(framer_->BuildDataPacket(header, queued_frames_, |
464 large_buffer.get(), packet_size_)); | 464 large_buffer.get(), packet_size_)); |
465 } | 465 } |
466 LOG_IF(DFATAL, packet == nullptr) << "Failed to serialize " | 466 if (packet == nullptr) { |
467 << queued_frames_.size() << " frames."; | 467 LOG(DFATAL) << "Failed to serialize " << queued_frames_.size() |
| 468 << " frames."; |
| 469 return NoPacket(); |
| 470 } |
468 | 471 |
469 OnBuiltFecProtectedPayload(header, packet->FecProtectedData()); | 472 OnBuiltFecProtectedPayload(header, packet->FecProtectedData()); |
470 | 473 |
471 // Because of possible truncation, we can't be confident that our | 474 // Because of possible truncation, we can't be confident that our |
472 // packet size calculation worked correctly. | 475 // packet size calculation worked correctly. |
473 if (!possibly_truncated_by_length) { | 476 if (!possibly_truncated_by_length) { |
474 DCHECK_EQ(packet_size_, packet->length()); | 477 DCHECK_EQ(packet_size_, packet->length()); |
475 } | 478 } |
476 // Immediately encrypt the packet, to ensure we don't encrypt the same packet | 479 // Immediately encrypt the packet, to ensure we don't encrypt the same packet |
477 // sequence number multiple times. | 480 // sequence number multiple times. |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
625 // Don't pad full packets. | 628 // Don't pad full packets. |
626 return; | 629 return; |
627 } | 630 } |
628 | 631 |
629 QuicPaddingFrame padding; | 632 QuicPaddingFrame padding; |
630 bool success = AddFrame(QuicFrame(&padding), false, false, nullptr); | 633 bool success = AddFrame(QuicFrame(&padding), false, false, nullptr); |
631 DCHECK(success); | 634 DCHECK(success); |
632 } | 635 } |
633 | 636 |
634 } // namespace net | 637 } // namespace net |
OLD | NEW |