Skip to content

Commit

Permalink
net: protect reinitialization
Browse files Browse the repository at this point in the history
  • Loading branch information
ShogunPanda committed Feb 14, 2023
1 parent 620a98d commit 873bbcc
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/tcp_wrap.cc
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,10 @@ void TCPWrap::Reinitialize(const FunctionCallbackInfo<Value>& args) {
ASSIGN_OR_RETURN_UNWRAP(
&wrap, args.Holder(), args.GetReturnValue().Set(UV_EBADF));

if (uv_is_active(reinterpret_cast<uv_handle_t*>(&wrap->handle_))) {
wrap->Close();
}

wrap->InitializeHandle();
}

Expand Down

0 comments on commit 873bbcc

Please sign in to comment.