mirror of
https://github.com/zebrajr/node.git
synced 2026-01-15 12:15:26 +00:00
quic: fixup NO_ERROR macro conflict on windows
PR-URL: https://github.com/nodejs/node/pull/59381 Fixes: https://github.com/nodejs/node/issues/59369 Reviewed-By: Filip Skokan <panva.ip@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Richard Lau <richard.lau@ibm.com>
This commit is contained in:
@@ -386,6 +386,8 @@ const QuicError QuicError::FromConnectionClose(ngtcp2_conn* session) {
|
||||
QUIC_TRANSPORT_ERRORS(V)
|
||||
#undef V
|
||||
|
||||
const QuicError QuicError::TRANSPORT_NO_ERROR =
|
||||
ForTransport(TransportError::NO_ERROR_);
|
||||
const QuicError QuicError::HTTP3_NO_ERROR = ForApplication(NGHTTP3_H3_NO_ERROR);
|
||||
const QuicError QuicError::VERSION_NEGOTIATION = ForVersionNegotiation();
|
||||
const QuicError QuicError::IDLE_CLOSE = ForIdleClose();
|
||||
|
||||
@@ -108,7 +108,6 @@ class Store final : public MemoryRetainer {
|
||||
|
||||
// Periodically, these need to be updated to match the latest ngtcp2 defs.
|
||||
#define QUIC_TRANSPORT_ERRORS(V) \
|
||||
V(NO_ERROR) \
|
||||
V(INTERNAL_ERROR) \
|
||||
V(CONNECTION_REFUSED) \
|
||||
V(FLOW_CONTROL_ERROR) \
|
||||
@@ -155,6 +154,10 @@ class QuicError final : public MemoryRetainer {
|
||||
public:
|
||||
// The known error codes for the transport namespace.
|
||||
enum class TransportError : error_code {
|
||||
// NO_ERROR has to be treated specially since it is a macro on
|
||||
// some Windows cases and results in a compile error if we leave
|
||||
// it as is.
|
||||
NO_ERROR_ = NGTCP2_NO_ERROR,
|
||||
#define V(name) name = NGTCP2_##name,
|
||||
QUIC_TRANSPORT_ERRORS(V)
|
||||
#undef V
|
||||
@@ -273,6 +276,7 @@ class QuicError final : public MemoryRetainer {
|
||||
|
||||
static const QuicError FromConnectionClose(ngtcp2_conn* session);
|
||||
|
||||
static const QuicError TRANSPORT_NO_ERROR;
|
||||
#define V(name) static const QuicError TRANSPORT_##name;
|
||||
QUIC_TRANSPORT_ERRORS(V)
|
||||
#undef V
|
||||
|
||||
@@ -16,7 +16,7 @@ TEST(QuicError, NoError) {
|
||||
CHECK_EQ(err.reason(), "");
|
||||
CHECK_EQ(err, QuicError::TRANSPORT_NO_ERROR);
|
||||
|
||||
CHECK_EQ(QuicError::TransportError::NO_ERROR, QuicError::QUIC_NO_ERROR);
|
||||
CHECK_EQ(QuicError::TransportError::NO_ERROR_, QuicError::QUIC_NO_ERROR);
|
||||
CHECK_EQ(QuicError::Http3Error::H3_NO_ERROR, QuicError::HTTP3_NO_ERROR_CODE);
|
||||
|
||||
QuicError err2("a reason");
|
||||
|
||||
Reference in New Issue
Block a user