From c9fbec2c4f81cbda45aa527ed976f8f90c2e0ed8 Mon Sep 17 00:00:00 2001 From: aperture-it Date: Tue, 6 Jan 2026 08:25:39 +0300 Subject: [PATCH] Add socket type to Unix domain socket --- include/uv.h | 1 + src/unix/pipe.c | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/include/uv.h b/include/uv.h index 41d7acc93..44cdbde59 100644 --- a/include/uv.h +++ b/include/uv.h @@ -871,6 +871,7 @@ struct uv_pipe_s { UV_HANDLE_FIELDS UV_STREAM_FIELDS int ipc; /* non-zero if this pipe is used for passing handles */ + int socket_type; /* socket type from enum __socket_type */ UV_PIPE_PRIVATE_FIELDS }; diff --git a/src/unix/pipe.c b/src/unix/pipe.c index eb03a47cc..68d1e162f 100644 --- a/src/unix/pipe.c +++ b/src/unix/pipe.c @@ -51,6 +51,7 @@ int uv_pipe_init(uv_loop_t* loop, uv_pipe_t* handle, int ipc) { handle->connect_req = NULL; handle->pipe_fname = NULL; handle->ipc = ipc; + handle->socket_type = SOCK_STREAM; return 0; } @@ -119,7 +120,7 @@ int uv_pipe_bind2(uv_pipe_t* handle, addrlen = sizeof saddr; } - err = uv__socket(AF_UNIX, SOCK_STREAM, 0); + err = uv__socket(AF_UNIX, handle->socket_type, 0); if (err < 0) goto err_socket; sockfd = err; @@ -286,7 +287,7 @@ int uv_pipe_connect2(uv_connect_t* req, new_sock = (uv__stream_fd(handle) == -1); if (new_sock) { - err = uv__socket(AF_UNIX, SOCK_STREAM, 0); + err = uv__socket(AF_UNIX, handle->socket_type, 0); if (err < 0) goto out; handle->io_watcher.fd = err;