Skip to content

Commit

Permalink
src: port Pipe to uv_pipe_bind2, uv_pipe_connect2
Browse files Browse the repository at this point in the history
The introduction of the uv_pipe_bind2 and uv_pipe_connect2 methods in
libuv v1.46.0 changed the behaviour of uv_pipe_bind and uv_pipe_connect.
This broke the ability to connect to abstract domain sockets on linux.
This change ports PipeWrap to use the new uv_pipe_bind2 and
uv_pipe_connect2 methods to restore abstract domain socket support.

Fixes: nodejs#49656
Refs: libuv/libuv#4030
  • Loading branch information
ggoodman committed Sep 15, 2023
1 parent ba28cd8 commit 1064baf
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/pipe_wrap.cc
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ void PipeWrap::Bind(const FunctionCallbackInfo<Value>& args) {
PipeWrap* wrap;
ASSIGN_OR_RETURN_UNWRAP(&wrap, args.Holder());
node::Utf8Value name(args.GetIsolate(), args[0]);
int err = uv_pipe_bind(&wrap->handle_, *name);
int err = uv_pipe_bind2(&wrap->handle_, *name, name.length(), 0);
args.GetReturnValue().Set(err);
}

Expand Down Expand Up @@ -237,9 +237,11 @@ void PipeWrap::Connect(const FunctionCallbackInfo<Value>& args) {

ConnectWrap* req_wrap =
new ConnectWrap(env, req_wrap_obj, AsyncWrap::PROVIDER_PIPECONNECTWRAP);
req_wrap->Dispatch(uv_pipe_connect,
req_wrap->Dispatch(uv_pipe_connect2,
&wrap->handle_,
*name,
name.length(),
0,
AfterConnect);

TRACE_EVENT_NESTABLE_ASYNC_BEGIN1(TRACING_CATEGORY_NODE2(net, native),
Expand Down

0 comments on commit 1064baf

Please sign in to comment.