Skip to content

Commit c535131

Browse files
committed
quic: additional minor cleanups in node_quic_session.h
PR-URL: #34247 Reviewed-By: Anna Henningsen <[email protected]>
1 parent e8f5745 commit c535131

File tree

1 file changed

+21
-18
lines changed

1 file changed

+21
-18
lines changed

src/quic/node_quic_session.h

Lines changed: 21 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -65,9 +65,9 @@ typedef void(*PreferredAddressStrategy)(
6565
// stack created and use a combination of an AliasedBuffer to pass
6666
// the numeric settings quickly (see node_quic_state.h) and passed
6767
// in non-numeric settings (e.g. preferred_addr).
68-
class QuicSessionConfig : public ngtcp2_settings {
68+
class QuicSessionConfig final : public ngtcp2_settings {
6969
public:
70-
QuicSessionConfig() {}
70+
QuicSessionConfig() = default;
7171

7272
explicit QuicSessionConfig(QuicState* quic_state) {
7373
Set(quic_state);
@@ -226,8 +226,8 @@ struct QuicSessionStatsTraits {
226226
static void ToString(const Base& ptr, Fn&& add_field);
227227
};
228228

229-
class QLogStream : public AsyncWrap,
230-
public StreamBase {
229+
class QLogStream final : public AsyncWrap,
230+
public StreamBase {
231231
public:
232232
static BaseObjectPtr<QLogStream> Create(Environment* env);
233233

@@ -311,7 +311,7 @@ class QuicSessionListener {
311311
friend class QuicSession;
312312
};
313313

314-
class JSQuicSessionListener : public QuicSessionListener {
314+
class JSQuicSessionListener final : public QuicSessionListener {
315315
public:
316316
void OnKeylog(const char* str, size_t size) override;
317317
void OnClientHello(
@@ -363,7 +363,7 @@ class JSQuicSessionListener : public QuicSessionListener {
363363

364364
// The QuicCryptoContext class encapsulates all of the crypto/TLS
365365
// handshake details on behalf of a QuicSession.
366-
class QuicCryptoContext : public MemoryRetainer {
366+
class QuicCryptoContext final : public MemoryRetainer {
367367
public:
368368
inline QuicCryptoContext(
369369
QuicSession* session,
@@ -697,12 +697,7 @@ class QuicApplication : public MemoryRetainer,
697697
V(SILENT_CLOSE, silent_closing) \
698698
V(STATELESS_RESET, stateless_reset)
699699

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
706701
// back and forth between peer endpoints via UDP. Every QuicSession
707702
// has an associated TLS context and all data transfered between
708703
// the peers is always encrypted. Unlike TLS over TCP, however,
@@ -713,9 +708,11 @@ class QuicApplication : public MemoryRetainer,
713708
// correction mechanisms to recover from lost packets, and flow
714709
// control. In other words, there's quite a bit going on within
715710
// 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> {
719716
public:
720717
// The default preferred address strategy is to ignore it
721718
static void IgnorePreferredAddressStrategy(
@@ -1080,13 +1077,15 @@ class QuicSession : public AsyncWrap,
10801077
// within the context of an ngtcp2 callback. When within an ngtcp2
10811078
// callback, SendPendingData will always be called when the callbacks
10821079
// complete.
1083-
class SendSessionScope {
1080+
class SendSessionScope final {
10841081
public:
10851082
explicit SendSessionScope(QuicSession* session)
10861083
: session_(session) {
10871084
CHECK(session_);
10881085
}
10891086

1087+
SendSessionScope(const SendSessionScope& other) = delete;
1088+
10901089
~SendSessionScope() {
10911090
if (Ngtcp2CallbackScope::InNgtcp2CallbackScope(session_.get()) ||
10921091
session_->is_in_closing_period() ||
@@ -1103,7 +1102,7 @@ class QuicSession : public AsyncWrap,
11031102
// ConnectionCloseScope triggers sending a CONNECTION_CLOSE
11041103
// when not executing within the context of an ngtcp2 callback
11051104
// and the session is in the correct state.
1106-
class ConnectionCloseScope {
1105+
class ConnectionCloseScope final {
11071106
public:
11081107
ConnectionCloseScope(QuicSession* session, bool silent = false)
11091108
: session_(session),
@@ -1116,6 +1115,8 @@ class QuicSession : public AsyncWrap,
11161115
session_->set_in_connection_close_scope();
11171116
}
11181117

1118+
ConnectionCloseScope(const ConnectionCloseScope& other) = delete;
1119+
11191120
~ConnectionCloseScope() {
11201121
if (silent_ ||
11211122
Ngtcp2CallbackScope::InNgtcp2CallbackScope(session_.get()) ||
@@ -1135,14 +1136,16 @@ class QuicSession : public AsyncWrap,
11351136
// Tracks whether or not we are currently within an ngtcp2 callback
11361137
// function. Certain ngtcp2 APIs are not supposed to be called when
11371138
// within a callback. We use this as a gate to check.
1138-
class Ngtcp2CallbackScope {
1139+
class Ngtcp2CallbackScope final {
11391140
public:
11401141
explicit Ngtcp2CallbackScope(QuicSession* session) : session_(session) {
11411142
CHECK(session_);
11421143
CHECK(!InNgtcp2CallbackScope(session));
11431144
session_->set_in_ngtcp2_callback();
11441145
}
11451146

1147+
Ngtcp2CallbackScope(const Ngtcp2CallbackScope& other) = delete;
1148+
11461149
~Ngtcp2CallbackScope() {
11471150
session_->set_in_ngtcp2_callback(false);
11481151
}

0 commit comments

Comments
 (0)