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 if (packet == nullptr) { | 466 LOG_IF(DFATAL, packet == nullptr) << "Failed to serialize " |
467 LOG(DFATAL) << "Failed to serialize " << queued_frames_.size() | 467 << queued_frames_.size() << " frames."; |
468 << " frames."; | |
469 return NoPacket(); | |
470 } | |
471 | 468 |
472 OnBuiltFecProtectedPayload(header, packet->FecProtectedData()); | 469 OnBuiltFecProtectedPayload(header, packet->FecProtectedData()); |
473 | 470 |
474 // Because of possible truncation, we can't be confident that our | 471 // Because of possible truncation, we can't be confident that our |
475 // packet size calculation worked correctly. | 472 // packet size calculation worked correctly. |
476 if (!possibly_truncated_by_length) { | 473 if (!possibly_truncated_by_length) { |
477 DCHECK_EQ(packet_size_, packet->length()); | 474 DCHECK_EQ(packet_size_, packet->length()); |
478 } | 475 } |
479 // Immediately encrypt the packet, to ensure we don't encrypt the same packet | 476 // Immediately encrypt the packet, to ensure we don't encrypt the same packet |
480 // sequence number multiple times. | 477 // sequence number multiple times. |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
628 // Don't pad full packets. | 625 // Don't pad full packets. |
629 return; | 626 return; |
630 } | 627 } |
631 | 628 |
632 QuicPaddingFrame padding; | 629 QuicPaddingFrame padding; |
633 bool success = AddFrame(QuicFrame(&padding), false, false, nullptr); | 630 bool success = AddFrame(QuicFrame(&padding), false, false, nullptr); |
634 DCHECK(success); | 631 DCHECK(success); |
635 } | 632 } |
636 | 633 |
637 } // namespace net | 634 } // namespace net |
OLD | NEW |