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 <cstdint> | 7 #include <cstdint> |
8 #include <memory> | 8 #include <memory> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 461 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
472 } | 472 } |
473 const QuicData& reset_serialized = reset.GetSerialized(); | 473 const QuicData& reset_serialized = reset.GetSerialized(); |
474 | 474 |
475 size_t len = | 475 size_t len = |
476 kPublicFlagsSize + PACKET_8BYTE_CONNECTION_ID + reset_serialized.length(); | 476 kPublicFlagsSize + PACKET_8BYTE_CONNECTION_ID + reset_serialized.length(); |
477 std::unique_ptr<char[]> buffer(new char[len]); | 477 std::unique_ptr<char[]> buffer(new char[len]); |
478 QuicDataWriter writer(len, buffer.get()); | 478 QuicDataWriter writer(len, buffer.get()); |
479 | 479 |
480 uint8_t flags = static_cast<uint8_t>(PACKET_PUBLIC_FLAGS_RST | | 480 uint8_t flags = static_cast<uint8_t>(PACKET_PUBLIC_FLAGS_RST | |
481 PACKET_PUBLIC_FLAGS_8BYTE_CONNECTION_ID); | 481 PACKET_PUBLIC_FLAGS_8BYTE_CONNECTION_ID); |
| 482 if (FLAGS_quic_use_old_public_reset_packets) { |
| 483 // TODO(rch): Remove this QUIC_VERSION_32 is retired. |
| 484 flags |= static_cast<uint8_t>(PACKET_PUBLIC_FLAGS_8BYTE_CONNECTION_ID_OLD); |
| 485 } |
482 if (!writer.WriteUInt8(flags)) { | 486 if (!writer.WriteUInt8(flags)) { |
483 return nullptr; | 487 return nullptr; |
484 } | 488 } |
485 | 489 |
486 if (!writer.WriteUInt64(packet.public_header.connection_id)) { | 490 if (!writer.WriteUInt64(packet.public_header.connection_id)) { |
487 return nullptr; | 491 return nullptr; |
488 } | 492 } |
489 | 493 |
490 if (!writer.WriteBytes(reset_serialized.data(), reset_serialized.length())) { | 494 if (!writer.WriteBytes(reset_serialized.data(), reset_serialized.length())) { |
491 return nullptr; | 495 return nullptr; |
(...skipping 2073 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2565 | 2569 |
2566 bool QuicFramer::RaiseError(QuicErrorCode error) { | 2570 bool QuicFramer::RaiseError(QuicErrorCode error) { |
2567 DVLOG(1) << "Error: " << QuicUtils::ErrorToString(error) | 2571 DVLOG(1) << "Error: " << QuicUtils::ErrorToString(error) |
2568 << " detail: " << detailed_error_; | 2572 << " detail: " << detailed_error_; |
2569 set_error(error); | 2573 set_error(error); |
2570 visitor_->OnError(this); | 2574 visitor_->OnError(this); |
2571 return false; | 2575 return false; |
2572 } | 2576 } |
2573 | 2577 |
2574 } // namespace net | 2578 } // namespace net |
OLD | NEW |