diff --git a/src/node_crypto.cc b/src/node_crypto.cc index 614c1067c6cc1b..480be4dd15e8fb 100644 --- a/src/node_crypto.cc +++ b/src/node_crypto.cc @@ -2849,6 +2849,24 @@ int SSLWrap::SetCACerts(SecureContext* sc) { } +Connection::Connection(Environment* env, + v8::Local wrap, + SecureContext* sc, + SSLWrap::Kind kind) + : AsyncWrap(env, wrap, AsyncWrap::PROVIDER_SSLCONNECTION), + SSLWrap(env, sc, kind), + bio_read_(nullptr), + bio_write_(nullptr), + hello_offset_(0) { + MakeWeak(this); + Wrap(wrap, this); + hello_parser_.Start(SSLWrap::OnClientHello, + OnClientHelloParseEnd, + this); + enable_session_callbacks(); +} + + void Connection::OnClientHelloParseEnd(void* arg) { Connection* conn = static_cast(arg); diff --git a/src/node_crypto.h b/src/node_crypto.h index 636cbb99d4dde6..463be5f0727000 100644 --- a/src/node_crypto.h +++ b/src/node_crypto.h @@ -432,19 +432,7 @@ class Connection : public AsyncWrap, public SSLWrap { Connection(Environment* env, v8::Local wrap, SecureContext* sc, - SSLWrap::Kind kind) - : AsyncWrap(env, wrap, AsyncWrap::PROVIDER_SSLCONNECTION), - SSLWrap(env, sc, kind), - bio_read_(nullptr), - bio_write_(nullptr), - hello_offset_(0) { - MakeWeak(this); - Wrap(wrap, this); - hello_parser_.Start(SSLWrap::OnClientHello, - OnClientHelloParseEnd, - this); - enable_session_callbacks(); - } + SSLWrap::Kind kind); private: static void SSLInfoCallback(const SSL *ssl, int where, int ret); diff --git a/src/node_crypto_clienthello-inl.h b/src/node_crypto_clienthello-inl.h index 019d7188de6cf3..5aff1816b2f73e 100644 --- a/src/node_crypto_clienthello-inl.h +++ b/src/node_crypto_clienthello-inl.h @@ -30,6 +30,21 @@ namespace node { namespace crypto { +inline ClientHelloParser::ClientHelloParser() + : state_(kEnded), + onhello_cb_(nullptr), + onend_cb_(nullptr), + cb_arg_(nullptr), + session_size_(0), + session_id_(nullptr), + servername_size_(0), + servername_(nullptr), + ocsp_request_(0), + tls_ticket_size_(0), + tls_ticket_(nullptr) { + Reset(); +} + inline void ClientHelloParser::Reset() { frame_len_ = 0; body_offset_ = 0; diff --git a/src/node_crypto_clienthello.h b/src/node_crypto_clienthello.h index 70f082b2c2a038..32c470677d04c0 100644 --- a/src/node_crypto_clienthello.h +++ b/src/node_crypto_clienthello.h @@ -33,19 +33,7 @@ namespace crypto { class ClientHelloParser { public: - ClientHelloParser() : state_(kEnded), - onhello_cb_(nullptr), - onend_cb_(nullptr), - cb_arg_(nullptr), - session_size_(0), - session_id_(nullptr), - servername_size_(0), - servername_(nullptr), - ocsp_request_(0), - tls_ticket_size_(0), - tls_ticket_(nullptr) { - Reset(); - } + inline ClientHelloParser(); class ClientHello { public: