Skip to content

Commit 8961d33

Browse files
addaleaxtargos
authored andcommitted
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 8e829d4 commit 8961d33

File tree

3 files changed

+10
-0
lines changed

3 files changed

+10
-0
lines changed

src/node_crypto.cc

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,7 @@ template void SSLWrap<TLSWrap>::AddMethods(Environment* env,
121121
template void SSLWrap<TLSWrap>::ConfigureSecureContext(SecureContext* sc);
122122
template void SSLWrap<TLSWrap>::SetSNIContext(SecureContext* sc);
123123
template int SSLWrap<TLSWrap>::SetCACerts(SecureContext* sc);
124+
template void SSLWrap<TLSWrap>::MemoryInfo(MemoryTracker* tracker) const;
124125
template SSL_SESSION* SSLWrap<TLSWrap>::GetSessionCallback(
125126
SSL* s,
126127
const unsigned char* key,
@@ -2488,6 +2489,12 @@ int SSLWrap<Base>::SetCACerts(SecureContext* sc) {
24882489
return 1;
24892490
}
24902491

2492+
template <class Base>
2493+
void SSLWrap<Base>::MemoryInfo(MemoryTracker* tracker) const {
2494+
tracker->TrackField("ocsp_response", ocsp_response_);
2495+
tracker->TrackField("sni_context", sni_context_);
2496+
}
2497+
24912498
int VerifyCallback(int preverify_ok, X509_STORE_CTX* ctx) {
24922499
// From https://www.openssl.org/docs/man1.1.1/man3/SSL_verify_cb:
24932500
//

src/node_crypto.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -215,6 +215,8 @@ class SSLWrap {
215215
inline bool is_awaiting_new_session() const { return awaiting_new_session_; }
216216
inline bool is_waiting_cert_cb() const { return cert_cb_ != nullptr; }
217217

218+
void MemoryInfo(MemoryTracker* tracker) const;
219+
218220
protected:
219221
typedef void (*CertCb)(void* arg);
220222

src/tls_wrap.cc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1240,6 +1240,7 @@ void TLSWrap::GetWriteQueueSize(const FunctionCallbackInfo<Value>& info) {
12401240

12411241

12421242
void TLSWrap::MemoryInfo(MemoryTracker* tracker) const {
1243+
SSLWrap<TLSWrap>::MemoryInfo(tracker);
12431244
tracker->TrackField("error", error_);
12441245
tracker->TrackFieldWithSize("pending_cleartext_input",
12451246
pending_cleartext_input_.size(),

0 commit comments

Comments
 (0)