GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — tls: zero SSL_CTX freelist for a singleUse socket · nodejs/node@2684c90

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • lib
    • _tls_common.js
    • _tls_wrap.js
  • src
    • node_crypto.cc
    • node_crypto.h
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎lib/_tls_common.js‎

Copy file name to clipboardExpand all lines: lib/_tls_common.js
+4Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,10 @@ exports.createSecureContext = function createSecureContext(options, context) {
133133
}
134134
}
135135

136+
// Do not keep read/write buffers in free list
137+
if (options.singleUse)
138+
c.context.setFreeListLength(0);
139+
136140
return c;
137141
};
138142

Collapse file

‎lib/_tls_wrap.js‎

Copy file name to clipboardExpand all lines: lib/_tls_wrap.js
+2Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -862,6 +862,8 @@ exports.connect = function(/* [port, host], options, cb */) {
862862
};
863863

864864
options = util._extend(defaults, options || {});
865+
if (!options.keepAlive)
866+
options.singleUse = true;
865867

866868
assert(typeof options.checkServerIdentity === 'function');
867869

Collapse file

‎src/node_crypto.cc‎

Copy file name to clipboardExpand all lines: src/node_crypto.cc
+8Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -265,6 +265,7 @@ void SecureContext::Initialize(Environment* env, Handle<Object> target) {
265265
env->SetProtoMethod(t, "loadPKCS12", SecureContext::LoadPKCS12);
266266
env->SetProtoMethod(t, "getTicketKeys", SecureContext::GetTicketKeys);
267267
env->SetProtoMethod(t, "setTicketKeys", SecureContext::SetTicketKeys);
268+
env->SetProtoMethod(t, "setFreeListLength", SecureContext::SetFreeListLength);
268269
env->SetProtoMethod(t, "getCertificate", SecureContext::GetCertificate<true>);
269270
env->SetProtoMethod(t, "getIssuer", SecureContext::GetCertificate<false>);
270271

@@ -933,6 +934,13 @@ void SecureContext::SetTicketKeys(const FunctionCallbackInfo<Value>& args) {
933934
}
934935

935936

937+
void SecureContext::SetFreeListLength(const FunctionCallbackInfo<Value>& args) {
938+
SecureContext* wrap = Unwrap<SecureContext>(args.Holder());
939+
940+
wrap->ctx_->freelist_max_len = args[0]->Int32Value();
941+
}
942+
943+
936944
void SecureContext::CtxGetter(Local<String> property,
937945
const PropertyCallbackInfo<Value>& info) {
938946
HandleScope scope(info.GetIsolate());
Collapse file

‎src/node_crypto.h‎

Copy file name to clipboardExpand all lines: src/node_crypto.h
+2Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,8 @@ class SecureContext : public BaseObject {
8585
static void LoadPKCS12(const v8::FunctionCallbackInfo<v8::Value>& args);
8686
static void GetTicketKeys(const v8::FunctionCallbackInfo<v8::Value>& args);
8787
static void SetTicketKeys(const v8::FunctionCallbackInfo<v8::Value>& args);
88+
static void SetFreeListLength(
89+
const v8::FunctionCallbackInfo<v8::Value>& args);
8890
static void CtxGetter(v8::Local<v8::String> property,
8991
const v8::PropertyCallbackInfo<v8::Value>& info);
9092

0 commit comments

Comments
0 (0)
You are visitor 01402792 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.