diff --git a/src/stream_base.cc b/src/stream_base.cc index a12a1efc73be11..3ed622d7ef35a2 100644 --- a/src/stream_base.cc +++ b/src/stream_base.cc @@ -82,10 +82,8 @@ void StreamBase::AfterShutdown(ShutdownWrap* req_wrap, int status) { req_wrap_obj }; - if (req_wrap->object()->Has(env->context(), - env->oncomplete_string()).FromJust()) { + if (req_wrap_obj->Has(env->context(), env->oncomplete_string()).FromJust()) req_wrap->MakeCallback(env->oncomplete_string(), arraysize(argv), argv); - } delete req_wrap; } @@ -172,9 +170,8 @@ int StreamBase::Writev(const FunctionCallbackInfo& args) { int err = DoWrite(req_wrap, *bufs, count, nullptr); - req_wrap->object()->Set(env->async(), True(env->isolate())); - req_wrap->object()->Set(env->bytes_string(), - Number::New(env->isolate(), bytes)); + req_wrap_obj->Set(env->async(), True(env->isolate())); + req_wrap_obj->Set(env->bytes_string(), Number::New(env->isolate(), bytes)); const char* msg = Error(); if (msg != nullptr) { req_wrap_obj->Set(env->error_string(), OneByteString(env->isolate(), msg)); @@ -328,7 +325,7 @@ int StreamBase::WriteString(const FunctionCallbackInfo& args) { // Reference StreamWrap instance to prevent it from being garbage // collected before `AfterWrite` is called. CHECK_EQ(false, req_wrap->persistent().IsEmpty()); - req_wrap->object()->Set(env->handle_string(), send_handle_obj); + req_wrap_obj->Set(env->handle_string(), send_handle_obj); } err = DoWrite( @@ -338,7 +335,7 @@ int StreamBase::WriteString(const FunctionCallbackInfo& args) { reinterpret_cast(send_handle)); } - req_wrap->object()->Set(env->async(), True(env->isolate())); + req_wrap_obj->Set(env->async(), True(env->isolate())); if (err) req_wrap->Dispose(); @@ -383,10 +380,8 @@ void StreamBase::AfterWrite(WriteWrap* req_wrap, int status) { wrap->ClearError(); } - if (req_wrap->object()->Has(env->context(), - env->oncomplete_string()).FromJust()) { + if (req_wrap_obj->Has(env->context(), env->oncomplete_string()).FromJust()) req_wrap->MakeCallback(env->oncomplete_string(), arraysize(argv), argv); - } req_wrap->Dispose(); }