Skip to content

Commit

Permalink
src: remove redundant JSStream::DoAfterWrite
Browse files Browse the repository at this point in the history
`Finish<WriteWrap>` already does the same thing and is
called immediately afterwards anyway.

PR-URL: nodejs#17713
Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Reviewed-By: Anatoli Papirovski <apapirovski@mac.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
  • Loading branch information
addaleax committed Dec 21, 2017
1 parent 1af82f3 commit 901e9a1
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 15 deletions.
2 changes: 0 additions & 2 deletions lib/internal/wrap_js_stream.js
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,6 @@ class JSStreamWrap extends Socket {
if (!self._dequeue(item))
return;

handle.doAfterWrite(req);
handle.finishWrite(req, errCode);
});
}
Expand Down Expand Up @@ -196,7 +195,6 @@ class JSStreamWrap extends Socket {

const errCode = uv.UV_ECANCELED;
if (item.type === 'write') {
handle.doAfterWrite(req);
handle.finishWrite(req, errCode);
} else if (item.type === 'shutdown') {
handle.finishShutdown(req, errCode);
Expand Down
12 changes: 0 additions & 12 deletions src/js_stream.cc
Original file line number Diff line number Diff line change
Expand Up @@ -169,17 +169,6 @@ void JSStream::New(const FunctionCallbackInfo<Value>& args) {
}


void JSStream::DoAfterWrite(const FunctionCallbackInfo<Value>& args) {
JSStream* wrap;
CHECK(args[0]->IsObject());
WriteWrap* w;
ASSIGN_OR_RETURN_UNWRAP(&wrap, args.Holder());
ASSIGN_OR_RETURN_UNWRAP(&w, args[0].As<Object>());

w->Done(0);
}


template <class Wrap>
void JSStream::Finish(const FunctionCallbackInfo<Value>& args) {
Wrap* w;
Expand Down Expand Up @@ -234,7 +223,6 @@ void JSStream::Initialize(Local<Object> target,

AsyncWrap::AddWrapMethods(env, t);

env->SetProtoMethod(t, "doAfterWrite", DoAfterWrite);
env->SetProtoMethod(t, "finishWrite", Finish<WriteWrap>);
env->SetProtoMethod(t, "finishShutdown", Finish<ShutdownWrap>);
env->SetProtoMethod(t, "readBuffer", ReadBuffer);
Expand Down
1 change: 0 additions & 1 deletion src/js_stream.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ class JSStream : public AsyncWrap, public StreamBase {
AsyncWrap* GetAsyncWrap() override;

static void New(const v8::FunctionCallbackInfo<v8::Value>& args);
static void DoAfterWrite(const v8::FunctionCallbackInfo<v8::Value>& args);
static void ReadBuffer(const v8::FunctionCallbackInfo<v8::Value>& args);
static void EmitEOF(const v8::FunctionCallbackInfo<v8::Value>& args);

Expand Down

0 comments on commit 901e9a1

Please sign in to comment.