Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
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
Next Next commit
src: pass along errors from tls object creation
  • Loading branch information
addaleax committed Jan 30, 2019
commit f8ea8fa5ac4b2a1a5c4453ccebf56ffad5a18bdd
15 changes: 10 additions & 5 deletions src/tls_wrap.cc
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,11 @@ using v8::String;
using v8::Value;

TLSWrap::TLSWrap(Environment* env,
Local<Object> obj,
Kind kind,
StreamBase* stream,
SecureContext* sc)
: AsyncWrap(env,
env->tls_wrap_constructor_function()
->NewInstance(env->context()).ToLocalChecked(),
AsyncWrap::PROVIDER_TLSWRAP),
: AsyncWrap(env, obj, AsyncWrap::PROVIDER_TLSWRAP),
SSLWrap<TLSWrap>(env, sc, kind),
StreamBase(env),
sc_(sc) {
Expand Down Expand Up @@ -160,7 +158,14 @@ void TLSWrap::Wrap(const FunctionCallbackInfo<Value>& args) {
StreamBase* stream = static_cast<StreamBase*>(stream_obj->Value());
CHECK_NOT_NULL(stream);

TLSWrap* res = new TLSWrap(env, kind, stream, Unwrap<SecureContext>(sc));
Local<Object> obj;
if (!env->tls_wrap_constructor_function()
->NewInstance(env->context())
.ToLocal(&obj)) {
return;
}

TLSWrap* res = new TLSWrap(env, obj, kind, stream, Unwrap<SecureContext>(sc));

args.GetReturnValue().Set(res->object());
}
Expand Down
1 change: 1 addition & 0 deletions src/tls_wrap.h
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ class TLSWrap : public AsyncWrap,
static const int kSimultaneousBufferCount = 10;

TLSWrap(Environment* env,
v8::Local<v8::Object> obj,
Kind kind,
StreamBase* stream,
crypto::SecureContext* sc);
Expand Down