Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

src: remove unnecessary comment and add a CHECK in crypto_tls.cc #39991

Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 1 addition & 8 deletions src/crypto/crypto_tls.cc
Original file line number Diff line number Diff line change
Expand Up @@ -144,26 +144,19 @@ int NewSessionCallback(SSL* s, SSL_SESSION* sess) {
return 0;

// Serialize session
// TODO(@jasnell): An AllocatedBuffer or BackingStore would be better
RaisinTen marked this conversation as resolved.
Show resolved Hide resolved
// here to start eliminating unnecessary uses of Buffer where an ordinary
// Uint8Array would do just fine.
Local<Object> session = Buffer::New(env, size).FromMaybe(Local<Object>());
if (UNLIKELY(session.IsEmpty()))
return 0;

unsigned char* session_data =
reinterpret_cast<unsigned char*>(Buffer::Data(session));

memset(session_data, 0, size);
RaisinTen marked this conversation as resolved.
Show resolved Hide resolved
i2d_SSL_SESSION(sess, &session_data);
CHECK_EQ(i2d_SSL_SESSION(sess, &session_data), size);

unsigned int session_id_length;
const unsigned char* session_id_data =
SSL_SESSION_get_id(sess, &session_id_length);

// TODO(@jasnell): An AllocatedBuffer or BackingStore would be better
// here to start eliminating unnecessary uses of Buffer where an ordinary
// Uint8Array would do just fine
Local<Object> session_id = Buffer::Copy(
env,
reinterpret_cast<const char*>(session_id_data),
Expand Down