mirror of
https://github.com/facebookincubator/mvfst.git
synced 2025-11-25 15:43:13 +03:00
uint64_t for all error codes
Summary: As in title. This is probably old legacy predating varints. Reviewed By: jbeshay, hanidamlaj Differential Revision: D47521039 fbshipit-source-id: d52a09a5fda045d2d3101f9b77a64a75e656954c
This commit is contained in:
committed by
Facebook GitHub Bot
parent
c06e3a0bec
commit
75b57f1f7b
@@ -23,6 +23,8 @@ using TimePoint = std::chrono::time_point<Clock>;
|
|||||||
using DurationRep = std::chrono::microseconds::rep;
|
using DurationRep = std::chrono::microseconds::rep;
|
||||||
using namespace std::chrono_literals;
|
using namespace std::chrono_literals;
|
||||||
|
|
||||||
|
constexpr uint64_t kMaxVarInt = (1ull << 62) - 1;
|
||||||
|
|
||||||
// Default QUIC packet size for both read and write.
|
// Default QUIC packet size for both read and write.
|
||||||
// TODO(xtt): make them configurable
|
// TODO(xtt): make them configurable
|
||||||
constexpr uint64_t kDefaultV4UDPSendPacketLen = 1252;
|
constexpr uint64_t kDefaultV4UDPSendPacketLen = 1252;
|
||||||
@@ -227,7 +229,7 @@ inline constexpr uint16_t toFrameError(FrameType frame) {
|
|||||||
return 0x0100 | static_cast<uint8_t>(frame);
|
return 0x0100 | static_cast<uint8_t>(frame);
|
||||||
}
|
}
|
||||||
|
|
||||||
enum class TransportErrorCode : uint16_t {
|
enum class TransportErrorCode : uint64_t {
|
||||||
NO_ERROR = 0x0000,
|
NO_ERROR = 0x0000,
|
||||||
INTERNAL_ERROR = 0x0001,
|
INTERNAL_ERROR = 0x0001,
|
||||||
SERVER_BUSY = 0x0002,
|
SERVER_BUSY = 0x0002,
|
||||||
@@ -248,7 +250,7 @@ enum class TransportErrorCode : uint16_t {
|
|||||||
* Application error codes are opaque to QUIC transport. Each application
|
* Application error codes are opaque to QUIC transport. Each application
|
||||||
* protocol can define its own error codes.
|
* protocol can define its own error codes.
|
||||||
*/
|
*/
|
||||||
using ApplicationErrorCode = uint16_t;
|
using ApplicationErrorCode = uint64_t;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Example application error codes, or codes that can be used by very simple
|
* Example application error codes, or codes that can be used by very simple
|
||||||
@@ -259,13 +261,13 @@ using ApplicationErrorCode = uint16_t;
|
|||||||
* namespace of the same name.
|
* namespace of the same name.
|
||||||
*/
|
*/
|
||||||
namespace GenericApplicationErrorCode {
|
namespace GenericApplicationErrorCode {
|
||||||
enum GenericApplicationErrorCode : uint16_t {
|
enum GenericApplicationErrorCode : uint64_t {
|
||||||
NO_ERROR = 0x0000,
|
NO_ERROR = 0,
|
||||||
UNKNOWN = 0xFFFF
|
UNKNOWN = kMaxVarInt,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
enum class LocalErrorCode : uint32_t {
|
enum class LocalErrorCode : uint64_t {
|
||||||
// Local errors
|
// Local errors
|
||||||
NO_ERROR = 0x00000000,
|
NO_ERROR = 0x00000000,
|
||||||
CONNECT_FAILED = 0x40000000,
|
CONNECT_FAILED = 0x40000000,
|
||||||
@@ -463,7 +465,7 @@ constexpr uint64_t kDefaultConnectionWindowSize = 1024 * 1024;
|
|||||||
/* Stream Limits */
|
/* Stream Limits */
|
||||||
constexpr uint64_t kDefaultMaxStreamsBidirectional = 2048;
|
constexpr uint64_t kDefaultMaxStreamsBidirectional = 2048;
|
||||||
constexpr uint64_t kDefaultMaxStreamsUnidirectional = 2048;
|
constexpr uint64_t kDefaultMaxStreamsUnidirectional = 2048;
|
||||||
constexpr uint64_t kMaxStreamId = (1ull << 62) - 1;
|
constexpr uint64_t kMaxStreamId = kMaxVarInt;
|
||||||
constexpr uint64_t kInvalidStreamId = kMaxStreamId + 1;
|
constexpr uint64_t kInvalidStreamId = kMaxStreamId + 1;
|
||||||
constexpr uint64_t kMaxMaxStreams = 1ull << 60;
|
constexpr uint64_t kMaxMaxStreams = 1ull << 60;
|
||||||
|
|
||||||
|
|||||||
@@ -2071,7 +2071,7 @@ TEST_F(QuicWriteCodecTest, WriteRstStream) {
|
|||||||
|
|
||||||
auto builtOut = std::move(pktBuilder).buildTestPacket();
|
auto builtOut = std::move(pktBuilder).buildTestPacket();
|
||||||
auto regularPacket = builtOut.first;
|
auto regularPacket = builtOut.first;
|
||||||
EXPECT_EQ(13, rstStreamBytesWritten);
|
EXPECT_EQ(17, rstStreamBytesWritten);
|
||||||
auto& resultRstStreamFrame = *regularPacket.frames[0].asRstStreamFrame();
|
auto& resultRstStreamFrame = *regularPacket.frames[0].asRstStreamFrame();
|
||||||
EXPECT_EQ(errorCode, resultRstStreamFrame.errorCode);
|
EXPECT_EQ(errorCode, resultRstStreamFrame.errorCode);
|
||||||
EXPECT_EQ(id, resultRstStreamFrame.streamId);
|
EXPECT_EQ(id, resultRstStreamFrame.streamId);
|
||||||
@@ -2229,7 +2229,7 @@ TEST_F(QuicWriteCodecTest, WriteStopSending) {
|
|||||||
|
|
||||||
auto builtOut = std::move(pktBuilder).buildTestPacket();
|
auto builtOut = std::move(pktBuilder).buildTestPacket();
|
||||||
auto regularPacket = builtOut.first;
|
auto regularPacket = builtOut.first;
|
||||||
EXPECT_EQ(bytesWritten, 6);
|
EXPECT_EQ(bytesWritten, 10);
|
||||||
|
|
||||||
auto wireBuf = std::move(builtOut.second);
|
auto wireBuf = std::move(builtOut.second);
|
||||||
BufQueue queue;
|
BufQueue queue;
|
||||||
|
|||||||
Reference in New Issue
Block a user