GeezerVison is showing github.com — quic: start re-enabling quic with openssl 3.5 · nodejs/node@5556b15
File treeExpand file treeCollapse file tree Open diff view settings Expand file treeCollapse file tree Open diff view settings Collapse file Copy file name to clipboardExpand all lines: deps/ngtcp2/ngtcp2.gyp +1-1Lines changed: 1 addition & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
| 48 | 48 | 'ngtcp2/crypto/shared.c' | 49 | 49 | ], | 50 | 50 | 'ngtcp2_sources_quictls': [ | 51 | | - 'ngtcp2/crypto/quictls/quictls.c' | | 51 | + #'ngtcp2/crypto/quictls/quictls.c' | 52 | 52 | ], | 53 | 53 | 'ngtcp2_sources_boringssl': [ | 54 | 54 | 'ngtcp2/crypto/boringssl/boringssl.c' | |
Collapse file Copy file name to clipboardExpand all lines: node.gyp +6-4Lines changed: 6 additions & 4 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 192 | 192 | 'src/udp_wrap.cc', | 193 | 193 | 'src/util.cc', | 194 | 194 | 'src/uv.cc', | | 195 | + 'src/quic/cid.cc', | | 196 | + 'src/quic/data.cc', | 195 | 197 | # headers to make for a more pleasant IDE experience | 196 | 198 | 'src/aliased_buffer.h', | 197 | 199 | 'src/aliased_buffer-inl.h', | | 329 | 331 | 'src/udp_wrap.h', | 330 | 332 | 'src/util.h', | 331 | 333 | 'src/util-inl.h', | | 334 | + 'src/quic/cid.h', | | 335 | + 'src/quic/data.h', | | 336 | + 'src/quic/defs.h', | | 337 | + 'src/quic/guard.h', | 332 | 338 | ], | 333 | 339 | 'node_crypto_sources': [ | 334 | 340 | 'src/crypto/crypto_aes.cc', | | 393 | 399 | 'node_quic_sources': [ | 394 | 400 | 'src/quic/application.cc', | 395 | 401 | 'src/quic/bindingdata.cc', | 396 | | - 'src/quic/cid.cc', | 397 | | - 'src/quic/data.cc', | 398 | 402 | 'src/quic/endpoint.cc', | 399 | 403 | 'src/quic/http3.cc', | 400 | 404 | 'src/quic/logstream.cc', | | 408 | 412 | 'src/quic/transportparams.cc', | 409 | 413 | 'src/quic/application.h', | 410 | 414 | 'src/quic/bindingdata.h', | 411 | | - 'src/quic/cid.h', | 412 | | - 'src/quic/data.h', | 413 | 415 | 'src/quic/endpoint.h', | 414 | 416 | 'src/quic/http3.h', | 415 | 417 | 'src/quic/logstream.h', | |
Collapse file Copy file name to clipboardExpand all lines: node.gypi +2Lines changed: 2 additions & 0 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 390 | 390 | 'defines': [ 'OPENSSL_API_COMPAT=0x10100000L', ], | 391 | 391 | 'dependencies': [ | 392 | 392 | './deps/openssl/openssl.gyp:openssl', | | 393 | + './deps/ngtcp2/ngtcp2.gyp:ngtcp2', | | 394 | + './deps/ngtcp2/ngtcp2.gyp:nghttp3', | 393 | 395 |
| 394 | 396 | # For tests | 395 | 397 | './deps/openssl/openssl.gyp:openssl-cli', | |
Collapse file Copy file name to clipboardExpand all lines: src/quic/cid.cc +13-10Lines changed: 13 additions & 10 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 1 | | -#if HAVE_OPENSSL && NODE_OPENSSL_HAS_QUIC | 2 | | -#include "cid.h" | | 1 | +#if HAVE_OPENSSL | | 2 | +#include "guard.h" | | 3 | +#ifndef OPENSSL_NO_QUIC | 3 | 4 | #include <crypto/crypto_util.h> | 4 | 5 | #include <memory_tracker-inl.h> | 5 | 6 | #include <node_mutex.h> | 6 | 7 | #include <string_bytes.h> | | 8 | +#include "cid.h" | | 9 | +#include "defs.h" | 7 | 10 | #include "nbytes.h" | 8 | 11 | #include "ncrypto.h" | 9 | | -#include "quic/defs.h" | 10 | 12 |
| 11 | 13 | namespace node::quic { | 12 | 14 |
| @@ -77,7 +79,7 @@ std::string CID::ToString() const { | 77 | 79 | return std::string(dest, written); | 78 | 80 | } | 79 | 81 |
| 80 | | -CID CID::kInvalid{}; | | 82 | +const CID CID::kInvalid{}; | 81 | 83 |
| 82 | 84 | // ============================================================================ | 83 | 85 | // CID::Hash | @@ -95,12 +97,12 @@ size_t CID::Hash::operator()(const CID& cid) const { | 95 | 97 | // CID::Factory | 96 | 98 |
| 97 | 99 | namespace { | 98 | | -class RandomCIDFactory : public CID::Factory { | | 100 | +class RandomCIDFactory final : public CID::Factory { | 99 | 101 | public: | 100 | 102 | RandomCIDFactory() = default; | 101 | 103 | DISALLOW_COPY_AND_MOVE(RandomCIDFactory) | 102 | 104 |
| 103 | | - CID Generate(size_t length_hint) const override { | | 105 | + const CID Generate(size_t length_hint) const override { | 104 | 106 | DCHECK_GE(length_hint, CID::kMinLength); | 105 | 107 | DCHECK_LE(length_hint, CID::kMaxLength); | 106 | 108 | Mutex::ScopedLock lock(mutex_); | @@ -110,8 +112,8 @@ class RandomCIDFactory : public CID::Factory { | 110 | 112 | return CID(start, length_hint); | 111 | 113 | } | 112 | 114 |
| 113 | | - CID GenerateInto(ngtcp2_cid* cid, | 114 | | - size_t length_hint = CID::kMaxLength) const override { | | 115 | + const CID GenerateInto(ngtcp2_cid* cid, | | 116 | + size_t length_hint = CID::kMaxLength) const override { | 115 | 117 | DCHECK_GE(length_hint, CID::kMinLength); | 116 | 118 | DCHECK_LE(length_hint, CID::kMaxLength); | 117 | 119 | Mutex::ScopedLock lock(mutex_); | @@ -135,7 +137,7 @@ class RandomCIDFactory : public CID::Factory { | 135 | 137 | } | 136 | 138 | } | 137 | 139 |
| 138 | | - static constexpr int kPoolSize = 4096; | | 140 | + static constexpr int kPoolSize = 1024 * 16; | 139 | 141 | mutable int pos_ = kPoolSize; | 140 | 142 | mutable uint8_t pool_[kPoolSize]; | 141 | 143 | mutable Mutex mutex_; | @@ -148,4 +150,5 @@ const CID::Factory& CID::Factory::random() { | 148 | 150 | } | 149 | 151 |
| 150 | 152 | } // namespace node::quic | 151 | | -#endif // HAVE_OPENSSL && NODE_OPENSSL_HAS_QUIC | | 153 | +#endif // OPENSSL_NO_QUIC | | 154 | +#endif // HAVE_OPENSS |
Collapse file Copy file name to clipboardExpand all lines: src/quic/cid.h +10-9Lines changed: 10 additions & 9 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 1 | 1 | #pragma once | 2 | 2 |
| 3 | 3 | #if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS | 4 | | -#if HAVE_OPENSSL && NODE_OPENSSL_HAS_QUIC | | 4 | + | 5 | 5 | #include <memory_tracker.h> | 6 | 6 | #include <ngtcp2/ngtcp2.h> | 7 | 7 | #include <string> | @@ -51,7 +51,7 @@ class CID final : public MemoryRetainer { | 51 | 51 |
| 52 | 52 | CID(const CID& other); | 53 | 53 | CID& operator=(const CID& other); | 54 | | - CID(CID&&) = delete; | | 54 | + DISALLOW_MOVE(CID) | 55 | 55 |
| 56 | 56 | struct Hash final { | 57 | 57 | size_t operator()(const CID& cid) const; | @@ -68,14 +68,16 @@ class CID final : public MemoryRetainer { | 68 | 68 | operator bool() const; | 69 | 69 | size_t length() const; | 70 | 70 |
| | 71 | + // Returns a hex-encoded string representation of the CID useful | | 72 | + // for debugging. | 71 | 73 | std::string ToString() const; | 72 | 74 |
| 73 | 75 | SET_NO_MEMORY_INFO() | 74 | 76 | SET_MEMORY_INFO_NAME(CID) | 75 | 77 | SET_SELF_SIZE(CID) | 76 | 78 |
| 77 | 79 | template <typename T> | 78 | | - using Map = std::unordered_map<CID, T, CID::Hash>; | | 80 | + using Map = std::unordered_map<const CID, T, CID::Hash>; | 79 | 81 |
| 80 | 82 | // A CID::Factory, as the name suggests, is used to create new CIDs. | 81 | 83 | // Per https://datatracker.ietf.org/doc/draft-ietf-quic-load-balancers/, QUIC | @@ -85,13 +87,13 @@ class CID final : public MemoryRetainer { | 85 | 87 | // but will allow user code to provide their own CID::Factory implementation. | 86 | 88 | class Factory; | 87 | 89 |
| 88 | | - static CID kInvalid; | | 90 | + static const CID kInvalid; | 89 | 91 |
| 90 | 92 | // The default constructor creates an empty, zero-length CID. | 91 | 93 | // Zero-length CIDs are not usable. We use them as a placeholder | 92 | 94 | // for a missing or empty CID value. This is public only because | 93 | 95 | // it is required for the CID::Map implementation. It should not | 94 | | - // be used. Use kInvalid instead. | | 96 | + // be used directly. Use kInvalid instead. | 95 | 97 | CID(); | 96 | 98 |
| 97 | 99 | private: | @@ -107,12 +109,12 @@ class CID::Factory { | 107 | 109 |
| 108 | 110 | // Generate a new CID. The length_hint must be between CID::kMinLength | 109 | 111 | // and CID::kMaxLength. The implementation can choose to ignore the length. | 110 | | - virtual CID Generate(size_t length_hint = CID::kMaxLength) const = 0; | | 112 | + virtual const CID Generate(size_t length_hint = CID::kMaxLength) const = 0; | 111 | 113 |
| 112 | 114 | // Generate a new CID into the given ngtcp2_cid. This variation of | 113 | 115 | // Generate should be used far less commonly. | 114 | | - virtual CID GenerateInto(ngtcp2_cid* cid, | 115 | | - size_t length_hint = CID::kMaxLength) const = 0; | | 116 | + virtual const CID GenerateInto( | | 117 | + ngtcp2_cid* cid, size_t length_hint = CID::kMaxLength) const = 0; | 116 | 118 |
| 117 | 119 | // The default random CID generator instance. | 118 | 120 | static const Factory& random(); | @@ -123,5 +125,4 @@ class CID::Factory { | 123 | 125 |
| 124 | 126 | } // namespace node::quic | 125 | 127 |
| 126 | | -#endif // HAVE_OPENSSL && NODE_OPENSSL_HAS_QUIC | 127 | 128 | #endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS |
|