Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(163)

Side by Side Diff: net/quic/quic_packet_creator.cc

Issue 1433703005: Pass in connection ID and supported version to QuicFramer::BuildVersionNegotiationPacket, instead … (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@106947577
Patch Set: Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « net/quic/quic_framer_test.cc ('k') | net/tools/quic/end_to_end_test.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 581 matching lines...) Expand 10 before | Expand all | Expand 10 after
592 header.packet_number, header.public_header.packet_number_length, buffer, 592 header.packet_number, header.public_header.packet_number_length, buffer,
593 encrypted_length, /* owns_buffer */ false, 593 encrypted_length, /* owns_buffer */ false,
594 QuicFramer::GetPacketEntropyHash(header), nullptr, false, false); 594 QuicFramer::GetPacketEntropyHash(header), nullptr, false, false);
595 serialized.is_fec_packet = true; 595 serialized.is_fec_packet = true;
596 return serialized; 596 return serialized;
597 } 597 }
598 598
599 QuicEncryptedPacket* QuicPacketCreator::SerializeVersionNegotiationPacket( 599 QuicEncryptedPacket* QuicPacketCreator::SerializeVersionNegotiationPacket(
600 const QuicVersionVector& supported_versions) { 600 const QuicVersionVector& supported_versions) {
601 DCHECK_EQ(Perspective::IS_SERVER, framer_->perspective()); 601 DCHECK_EQ(Perspective::IS_SERVER, framer_->perspective());
602 QuicPacketPublicHeader header; 602 QuicEncryptedPacket* encrypted = QuicFramer::BuildVersionNegotiationPacket(
603 header.connection_id = connection_id_; 603 connection_id_, supported_versions);
604 header.reset_flag = false;
605 header.version_flag = true;
606 header.versions = supported_versions;
607 QuicEncryptedPacket* encrypted =
608 framer_->BuildVersionNegotiationPacket(header, supported_versions);
609 DCHECK(encrypted); 604 DCHECK(encrypted);
610 DCHECK_GE(max_packet_length_, encrypted->length()); 605 DCHECK_GE(max_packet_length_, encrypted->length());
611 return encrypted; 606 return encrypted;
612 } 607 }
613 608
614 SerializedPacket QuicPacketCreator::NoPacket() { 609 SerializedPacket QuicPacketCreator::NoPacket() {
615 return SerializedPacket(0, PACKET_1BYTE_PACKET_NUMBER, nullptr, 0, nullptr, 610 return SerializedPacket(0, PACKET_1BYTE_PACKET_NUMBER, nullptr, 0, nullptr,
616 false, false); 611 false, false);
617 } 612 }
618 613
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
685 if (BytesFree() == 0) { 680 if (BytesFree() == 0) {
686 // Don't pad full packets. 681 // Don't pad full packets.
687 return; 682 return;
688 } 683 }
689 684
690 bool success = AddFrame(QuicFrame(QuicPaddingFrame()), false, false, nullptr); 685 bool success = AddFrame(QuicFrame(QuicPaddingFrame()), false, false, nullptr);
691 DCHECK(success); 686 DCHECK(success);
692 } 687 }
693 688
694 } // namespace net 689 } // namespace net
OLDNEW
« no previous file with comments | « net/quic/quic_framer_test.cc ('k') | net/tools/quic/end_to_end_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698