@@ -65,9 +65,9 @@ typedef void(*PreferredAddressStrategy)(
65
65
// stack created and use a combination of an AliasedBuffer to pass
66
66
// the numeric settings quickly (see node_quic_state.h) and passed
67
67
// in non-numeric settings (e.g. preferred_addr).
68
- class QuicSessionConfig : public ngtcp2_settings {
68
+ class QuicSessionConfig final : public ngtcp2_settings {
69
69
public:
70
- QuicSessionConfig () {}
70
+ QuicSessionConfig () = default ;
71
71
72
72
explicit QuicSessionConfig (QuicState* quic_state) {
73
73
Set (quic_state);
@@ -226,8 +226,8 @@ struct QuicSessionStatsTraits {
226
226
static void ToString (const Base& ptr, Fn&& add_field);
227
227
};
228
228
229
- class QLogStream : public AsyncWrap ,
230
- public StreamBase {
229
+ class QLogStream final : public AsyncWrap,
230
+ public StreamBase {
231
231
public:
232
232
static BaseObjectPtr<QLogStream> Create (Environment* env);
233
233
@@ -311,7 +311,7 @@ class QuicSessionListener {
311
311
friend class QuicSession ;
312
312
};
313
313
314
- class JSQuicSessionListener : public QuicSessionListener {
314
+ class JSQuicSessionListener final : public QuicSessionListener {
315
315
public:
316
316
void OnKeylog (const char * str, size_t size) override ;
317
317
void OnClientHello (
@@ -363,7 +363,7 @@ class JSQuicSessionListener : public QuicSessionListener {
363
363
364
364
// The QuicCryptoContext class encapsulates all of the crypto/TLS
365
365
// handshake details on behalf of a QuicSession.
366
- class QuicCryptoContext : public MemoryRetainer {
366
+ class QuicCryptoContext final : public MemoryRetainer {
367
367
public:
368
368
inline QuicCryptoContext (
369
369
QuicSession* session,
@@ -697,12 +697,7 @@ class QuicApplication : public MemoryRetainer,
697
697
V (SILENT_CLOSE, silent_closing) \
698
698
V (STATELESS_RESET, stateless_reset)
699
699
700
- // The QuicSession class is an virtual class that serves as
701
- // the basis for both client and server QuicSession.
702
- // It implements the functionality that is shared for both
703
- // QUIC clients and servers.
704
- //
705
- // QUIC sessions are virtual connections that exchange data
700
+ // QUIC sessions are logical connections that exchange data
706
701
// back and forth between peer endpoints via UDP. Every QuicSession
707
702
// has an associated TLS context and all data transfered between
708
703
// the peers is always encrypted. Unlike TLS over TCP, however,
@@ -713,9 +708,11 @@ class QuicApplication : public MemoryRetainer,
713
708
// correction mechanisms to recover from lost packets, and flow
714
709
// control. In other words, there's quite a bit going on within
715
710
// a QuicSession object.
716
- class QuicSession : public AsyncWrap ,
717
- public mem::NgLibMemoryManager<QuicSession, ngtcp2_mem>,
718
- public StatsBase<QuicSessionStatsTraits> {
711
+ class QuicSession final : public AsyncWrap,
712
+ public mem::NgLibMemoryManager<
713
+ QuicSession,
714
+ ngtcp2_mem>,
715
+ public StatsBase<QuicSessionStatsTraits> {
719
716
public:
720
717
// The default preferred address strategy is to ignore it
721
718
static void IgnorePreferredAddressStrategy (
@@ -1080,13 +1077,15 @@ class QuicSession : public AsyncWrap,
1080
1077
// within the context of an ngtcp2 callback. When within an ngtcp2
1081
1078
// callback, SendPendingData will always be called when the callbacks
1082
1079
// complete.
1083
- class SendSessionScope {
1080
+ class SendSessionScope final {
1084
1081
public:
1085
1082
explicit SendSessionScope (QuicSession* session)
1086
1083
: session_(session) {
1087
1084
CHECK (session_);
1088
1085
}
1089
1086
1087
+ SendSessionScope (const SendSessionScope& other) = delete ;
1088
+
1090
1089
~SendSessionScope () {
1091
1090
if (Ngtcp2CallbackScope::InNgtcp2CallbackScope (session_.get ()) ||
1092
1091
session_->is_in_closing_period () ||
@@ -1103,7 +1102,7 @@ class QuicSession : public AsyncWrap,
1103
1102
// ConnectionCloseScope triggers sending a CONNECTION_CLOSE
1104
1103
// when not executing within the context of an ngtcp2 callback
1105
1104
// and the session is in the correct state.
1106
- class ConnectionCloseScope {
1105
+ class ConnectionCloseScope final {
1107
1106
public:
1108
1107
ConnectionCloseScope (QuicSession* session, bool silent = false )
1109
1108
: session_(session),
@@ -1116,6 +1115,8 @@ class QuicSession : public AsyncWrap,
1116
1115
session_->set_in_connection_close_scope ();
1117
1116
}
1118
1117
1118
+ ConnectionCloseScope (const ConnectionCloseScope& other) = delete;
1119
+
1119
1120
~ConnectionCloseScope () {
1120
1121
if (silent_ ||
1121
1122
Ngtcp2CallbackScope::InNgtcp2CallbackScope (session_.get ()) ||
@@ -1135,14 +1136,16 @@ class QuicSession : public AsyncWrap,
1135
1136
// Tracks whether or not we are currently within an ngtcp2 callback
1136
1137
// function. Certain ngtcp2 APIs are not supposed to be called when
1137
1138
// within a callback. We use this as a gate to check.
1138
- class Ngtcp2CallbackScope {
1139
+ class Ngtcp2CallbackScope final {
1139
1140
public:
1140
1141
explicit Ngtcp2CallbackScope (QuicSession* session) : session_(session) {
1141
1142
CHECK (session_);
1142
1143
CHECK (!InNgtcp2CallbackScope (session));
1143
1144
session_->set_in_ngtcp2_callback ();
1144
1145
}
1145
1146
1147
+ Ngtcp2CallbackScope (const Ngtcp2CallbackScope& other) = delete ;
1148
+
1146
1149
~Ngtcp2CallbackScope () {
1147
1150
session_->set_in_ngtcp2_callback (false );
1148
1151
}
0 commit comments