Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 5556b15

Browse filesBrowse files
jasnelladuh95
authored andcommitted
quic: start re-enabling quic with openssl 3.5
Start working on re-enabling QUIC support with the availability of OpenSSL 3.5. This will be a multi-step process. Signed-off-by: James M Snell <jasnell@gmail.com> PR-URL: #59249 Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
1 parent 233894a commit 5556b15
Copy full SHA for 5556b15

12 files changed

+435-176Lines changed: 435 additions & 176 deletions

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎deps/ngtcp2/ngtcp2.gyp‎

Copy file name to clipboardExpand all lines: deps/ngtcp2/ngtcp2.gyp
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@
4848
'ngtcp2/crypto/shared.c'
4949
],
5050
'ngtcp2_sources_quictls': [
51-
'ngtcp2/crypto/quictls/quictls.c'
51+
#'ngtcp2/crypto/quictls/quictls.c'
5252
],
5353
'ngtcp2_sources_boringssl': [
5454
'ngtcp2/crypto/boringssl/boringssl.c'
Collapse file

‎node.gyp‎

Copy file name to clipboardExpand all lines: node.gyp
+6-4Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,8 @@
192192
'src/udp_wrap.cc',
193193
'src/util.cc',
194194
'src/uv.cc',
195+
'src/quic/cid.cc',
196+
'src/quic/data.cc',
195197
# headers to make for a more pleasant IDE experience
196198
'src/aliased_buffer.h',
197199
'src/aliased_buffer-inl.h',
@@ -329,6 +331,10 @@
329331
'src/udp_wrap.h',
330332
'src/util.h',
331333
'src/util-inl.h',
334+
'src/quic/cid.h',
335+
'src/quic/data.h',
336+
'src/quic/defs.h',
337+
'src/quic/guard.h',
332338
],
333339
'node_crypto_sources': [
334340
'src/crypto/crypto_aes.cc',
@@ -393,8 +399,6 @@
393399
'node_quic_sources': [
394400
'src/quic/application.cc',
395401
'src/quic/bindingdata.cc',
396-
'src/quic/cid.cc',
397-
'src/quic/data.cc',
398402
'src/quic/endpoint.cc',
399403
'src/quic/http3.cc',
400404
'src/quic/logstream.cc',
@@ -408,8 +412,6 @@
408412
'src/quic/transportparams.cc',
409413
'src/quic/application.h',
410414
'src/quic/bindingdata.h',
411-
'src/quic/cid.h',
412-
'src/quic/data.h',
413415
'src/quic/endpoint.h',
414416
'src/quic/http3.h',
415417
'src/quic/logstream.h',
Collapse file

‎node.gypi‎

Copy file name to clipboardExpand all lines: node.gypi
+2Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -390,6 +390,8 @@
390390
'defines': [ 'OPENSSL_API_COMPAT=0x10100000L', ],
391391
'dependencies': [
392392
'./deps/openssl/openssl.gyp:openssl',
393+
'./deps/ngtcp2/ngtcp2.gyp:ngtcp2',
394+
'./deps/ngtcp2/ngtcp2.gyp:nghttp3',
393395

394396
# For tests
395397
'./deps/openssl/openssl.gyp:openssl-cli',
Collapse file

‎src/quic/cid.cc‎

Copy file name to clipboardExpand all lines: src/quic/cid.cc
+13-10Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
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
34
#include <crypto/crypto_util.h>
45
#include <memory_tracker-inl.h>
56
#include <node_mutex.h>
67
#include <string_bytes.h>
8+
#include "cid.h"
9+
#include "defs.h"
710
#include "nbytes.h"
811
#include "ncrypto.h"
9-
#include "quic/defs.h"
1012

1113
namespace node::quic {
1214

@@ -77,7 +79,7 @@ std::string CID::ToString() const {
7779
return std::string(dest, written);
7880
}
7981

80-
CID CID::kInvalid{};
82+
const CID CID::kInvalid{};
8183

8284
// ============================================================================
8385
// CID::Hash
@@ -95,12 +97,12 @@ size_t CID::Hash::operator()(const CID& cid) const {
9597
// CID::Factory
9698

9799
namespace {
98-
class RandomCIDFactory : public CID::Factory {
100+
class RandomCIDFactory final : public CID::Factory {
99101
public:
100102
RandomCIDFactory() = default;
101103
DISALLOW_COPY_AND_MOVE(RandomCIDFactory)
102104

103-
CID Generate(size_t length_hint) const override {
105+
const CID Generate(size_t length_hint) const override {
104106
DCHECK_GE(length_hint, CID::kMinLength);
105107
DCHECK_LE(length_hint, CID::kMaxLength);
106108
Mutex::ScopedLock lock(mutex_);
@@ -110,8 +112,8 @@ class RandomCIDFactory : public CID::Factory {
110112
return CID(start, length_hint);
111113
}
112114

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 {
115117
DCHECK_GE(length_hint, CID::kMinLength);
116118
DCHECK_LE(length_hint, CID::kMaxLength);
117119
Mutex::ScopedLock lock(mutex_);
@@ -135,7 +137,7 @@ class RandomCIDFactory : public CID::Factory {
135137
}
136138
}
137139

138-
static constexpr int kPoolSize = 4096;
140+
static constexpr int kPoolSize = 1024 * 16;
139141
mutable int pos_ = kPoolSize;
140142
mutable uint8_t pool_[kPoolSize];
141143
mutable Mutex mutex_;
@@ -148,4 +150,5 @@ const CID::Factory& CID::Factory::random() {
148150
}
149151

150152
} // namespace node::quic
151-
#endif // HAVE_OPENSSL && NODE_OPENSSL_HAS_QUIC
153+
#endif // OPENSSL_NO_QUIC
154+
#endif // HAVE_OPENSS
Collapse file

‎src/quic/cid.h‎

Copy file name to clipboardExpand all lines: src/quic/cid.h
+10-9Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#pragma once
22

33
#if defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS
4-
#if HAVE_OPENSSL && NODE_OPENSSL_HAS_QUIC
4+
55
#include <memory_tracker.h>
66
#include <ngtcp2/ngtcp2.h>
77
#include <string>
@@ -51,7 +51,7 @@ class CID final : public MemoryRetainer {
5151

5252
CID(const CID& other);
5353
CID& operator=(const CID& other);
54-
CID(CID&&) = delete;
54+
DISALLOW_MOVE(CID)
5555

5656
struct Hash final {
5757
size_t operator()(const CID& cid) const;
@@ -68,14 +68,16 @@ class CID final : public MemoryRetainer {
6868
operator bool() const;
6969
size_t length() const;
7070

71+
// Returns a hex-encoded string representation of the CID useful
72+
// for debugging.
7173
std::string ToString() const;
7274

7375
SET_NO_MEMORY_INFO()
7476
SET_MEMORY_INFO_NAME(CID)
7577
SET_SELF_SIZE(CID)
7678

7779
template <typename T>
78-
using Map = std::unordered_map<CID, T, CID::Hash>;
80+
using Map = std::unordered_map<const CID, T, CID::Hash>;
7981

8082
// A CID::Factory, as the name suggests, is used to create new CIDs.
8183
// Per https://datatracker.ietf.org/doc/draft-ietf-quic-load-balancers/, QUIC
@@ -85,13 +87,13 @@ class CID final : public MemoryRetainer {
8587
// but will allow user code to provide their own CID::Factory implementation.
8688
class Factory;
8789

88-
static CID kInvalid;
90+
static const CID kInvalid;
8991

9092
// The default constructor creates an empty, zero-length CID.
9193
// Zero-length CIDs are not usable. We use them as a placeholder
9294
// for a missing or empty CID value. This is public only because
9395
// it is required for the CID::Map implementation. It should not
94-
// be used. Use kInvalid instead.
96+
// be used directly. Use kInvalid instead.
9597
CID();
9698

9799
private:
@@ -107,12 +109,12 @@ class CID::Factory {
107109

108110
// Generate a new CID. The length_hint must be between CID::kMinLength
109111
// 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;
111113

112114
// Generate a new CID into the given ngtcp2_cid. This variation of
113115
// 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;
116118

117119
// The default random CID generator instance.
118120
static const Factory& random();
@@ -123,5 +125,4 @@ class CID::Factory {
123125

124126
} // namespace node::quic
125127

126-
#endif // HAVE_OPENSSL && NODE_OPENSSL_HAS_QUIC
127128
#endif // defined(NODE_WANT_INTERNALS) && NODE_WANT_INTERNALS

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.