Skip to content

Commit 0b0f023

Browse files
committed
tls: add memory tracking support to SSLWrap
PR-URL: #30548 Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl> Reviewed-By: David Carlier <devnexen@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Tobias Nießen <tniessen@tnie.de>
1 parent 30a4f68 commit 0b0f023

File tree

3 files changed

+10
-0
lines changed

3 files changed

+10
-0
lines changed

src/node_crypto.cc

+7
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,7 @@ template void SSLWrap<TLSWrap>::AddMethods(Environment* env,
144144
template void SSLWrap<TLSWrap>::ConfigureSecureContext(SecureContext* sc);
145145
template void SSLWrap<TLSWrap>::SetSNIContext(SecureContext* sc);
146146
template int SSLWrap<TLSWrap>::SetCACerts(SecureContext* sc);
147+
template void SSLWrap<TLSWrap>::MemoryInfo(MemoryTracker* tracker) const;
147148
template SSL_SESSION* SSLWrap<TLSWrap>::GetSessionCallback(
148149
SSL* s,
149150
const unsigned char* key,
@@ -3074,6 +3075,12 @@ int SSLWrap<Base>::SetCACerts(SecureContext* sc) {
30743075
return 1;
30753076
}
30763077

3078+
template <class Base>
3079+
void SSLWrap<Base>::MemoryInfo(MemoryTracker* tracker) const {
3080+
tracker->TrackField("ocsp_response", ocsp_response_);
3081+
tracker->TrackField("sni_context", sni_context_);
3082+
}
3083+
30773084
int VerifyCallback(int preverify_ok, X509_STORE_CTX* ctx) {
30783085
// From https://www.openssl.org/docs/man1.1.1/man3/SSL_verify_cb:
30793086
//

src/node_crypto.h

+2
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,8 @@ class SSLWrap {
222222
inline bool is_awaiting_new_session() const { return awaiting_new_session_; }
223223
inline bool is_waiting_cert_cb() const { return cert_cb_ != nullptr; }
224224

225+
void MemoryInfo(MemoryTracker* tracker) const;
226+
225227
protected:
226228
typedef void (*CertCb)(void* arg);
227229

src/tls_wrap.cc

+1
Original file line numberDiff line numberDiff line change
@@ -1089,6 +1089,7 @@ void TLSWrap::GetWriteQueueSize(const FunctionCallbackInfo<Value>& info) {
10891089

10901090

10911091
void TLSWrap::MemoryInfo(MemoryTracker* tracker) const {
1092+
SSLWrap<TLSWrap>::MemoryInfo(tracker);
10921093
tracker->TrackField("error", error_);
10931094
tracker->TrackFieldWithSize("pending_cleartext_input",
10941095
pending_cleartext_input_.size(),

0 commit comments

Comments
 (0)