Skip to content

Commit 873bbcc

Browse files
committed
net: protect reinitialization
1 parent 620a98d commit 873bbcc

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/tcp_wrap.cc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -187,6 +187,10 @@ void TCPWrap::Reinitialize(const FunctionCallbackInfo<Value>& args) {
187187
ASSIGN_OR_RETURN_UNWRAP(
188188
&wrap, args.Holder(), args.GetReturnValue().Set(UV_EBADF));
189189

190+
if (uv_is_active(reinterpret_cast<uv_handle_t*>(&wrap->handle_))) {
191+
wrap->Close();
192+
}
193+
190194
wrap->InitializeHandle();
191195
}
192196

0 commit comments

Comments
 (0)