diff --git a/lib/_tls_wrap.js b/lib/_tls_wrap.js index 1fc339cc2e85af..b07812f1a66fea 100644 --- a/lib/_tls_wrap.js +++ b/lib/_tls_wrap.js @@ -214,7 +214,7 @@ function requestOCSPDone(socket) { } -function onnewsession(key, session) { +function onnewsession(sessionId, session) { const owner = this[owner_symbol]; if (!owner.server) @@ -238,7 +238,7 @@ function onnewsession(key, session) { }; owner._newSessionPending = true; - if (!owner.server.emit('newSession', key, session, done)) + if (!owner.server.emit('newSession', sessionId, session, done)) done(); } diff --git a/src/node_crypto.cc b/src/node_crypto.cc index 8d5ac869196318..201b1815e1ae80 100644 --- a/src/node_crypto.cc +++ b/src/node_crypto.cc @@ -1510,20 +1510,20 @@ int SSLWrap::NewSessionCallback(SSL* s, SSL_SESSION* sess) { return 0; // Serialize session - Local buff = Buffer::New(env, size).ToLocalChecked(); - unsigned char* serialized = reinterpret_cast( - Buffer::Data(buff)); - memset(serialized, 0, size); - i2d_SSL_SESSION(sess, &serialized); + Local session = Buffer::New(env, size).ToLocalChecked(); + unsigned char* session_data = reinterpret_cast( + Buffer::Data(session)); + memset(session_data, 0, size); + i2d_SSL_SESSION(sess, &session_data); unsigned int session_id_length; - const unsigned char* session_id = SSL_SESSION_get_id(sess, - &session_id_length); - Local session = Buffer::Copy( + const unsigned char* session_id_data = SSL_SESSION_get_id(sess, + &session_id_length); + Local session_id = Buffer::Copy( env, - reinterpret_cast(session_id), + reinterpret_cast(session_id_data), session_id_length).ToLocalChecked(); - Local argv[] = { session, buff }; + Local argv[] = { session_id, session }; w->new_session_wait_ = true; w->MakeCallback(env->onnewsession_string(), arraysize(argv), argv);