src: add comments
This commit is contained in:
parent
2d64fe4a40
commit
32f3e0dbae
@ -868,8 +868,8 @@ enum uv_pipe_init_flags {
|
||||
UV_PIPE_INIT_IPC = 1u << 0,
|
||||
|
||||
/*
|
||||
* Use the name as Unix Domain Socket filepath instead of NamedPipe
|
||||
* name on Windows.
|
||||
* Use Unix Domain Socket instead of NamedPipe on Windows. Will validate
|
||||
* the `name` as a file path when calling bind / connect if this flag is set.
|
||||
*/
|
||||
UV_PIPE_INIT_WIN_UDS = 1u << 1,
|
||||
};
|
||||
|
||||
@ -377,7 +377,8 @@ typedef struct {
|
||||
HANDLE pipeHandle; \
|
||||
DWORD duplex_flags; \
|
||||
/* When using unix domain socket, ConnectEx IOCP result will overwrite
|
||||
* result + pipeHandle, to keep the ABI, reusing the name field.
|
||||
* result + pipeHandle, to keep the ABI, reusing the name field to store
|
||||
* the pending uds_socket for connect handler.
|
||||
*/ \
|
||||
union { \
|
||||
WCHAR* name; \
|
||||
@ -492,6 +493,10 @@ typedef struct {
|
||||
|
||||
#define UV_PIPE_PRIVATE_FIELDS \
|
||||
HANDLE handle; \
|
||||
/*
|
||||
* The uds doesn't use wchar name, reuse this memory to store raw utf-8 name
|
||||
* while keep the ABI compact.
|
||||
*/ \
|
||||
union { \
|
||||
char* pathname; \
|
||||
WCHAR* name; \
|
||||
|
||||
@ -102,7 +102,12 @@ static void eof_timer_cb(uv_timer_t* timer);
|
||||
static void eof_timer_destroy(uv_pipe_t* pipe);
|
||||
static void eof_timer_close_cb(uv_handle_t* handle);
|
||||
|
||||
|
||||
/*
|
||||
* When use with bind, the file path must not exist for successful creation
|
||||
* of server socket. When use with connect, the file path must exist so that
|
||||
* the client socket can connect to.
|
||||
* The UDS on Windows only supports this pathname mode.
|
||||
*/
|
||||
static int uv__win_uds_pipe_file_exists(const char* path, int* exists) {
|
||||
if (!exists || !path) {
|
||||
return UV_EINVAL;
|
||||
@ -154,6 +159,9 @@ int uv_pipe_init(uv_loop_t* loop, uv_pipe_t* handle, int ipc) {
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Init pipe with flags.
|
||||
*/
|
||||
int uv_pipe_init_ex(uv_loop_t* loop, uv_pipe_t* handle, unsigned int flags) {
|
||||
int ipc = (flags & UV_PIPE_INIT_IPC) != 0;
|
||||
int uds = (flags & UV_PIPE_INIT_WIN_UDS) != 0;
|
||||
@ -259,7 +267,7 @@ static void close_pipe(uv_pipe_t* pipe) {
|
||||
pipe->handle = INVALID_HANDLE_VALUE;
|
||||
}
|
||||
|
||||
/* Pipe pair doesn't use unix domain socket */
|
||||
/* Pipe pair use named pipe only, no uds support. */
|
||||
static int uv__pipe_server(
|
||||
HANDLE* pipeHandle_ptr, DWORD access,
|
||||
char* name, size_t nameSize, unsigned long long random) {
|
||||
@ -300,7 +308,7 @@ static int uv__pipe_server(
|
||||
}
|
||||
|
||||
|
||||
/* Pipe pair doesn't use unix domain socket */
|
||||
/* Pipe pair use named pipe only, no uds support. */
|
||||
static int uv__create_pipe_pair(
|
||||
HANDLE* server_pipe_ptr, HANDLE* client_pipe_ptr,
|
||||
unsigned int server_flags, unsigned int client_flags,
|
||||
@ -401,7 +409,7 @@ static int uv__create_pipe_pair(
|
||||
}
|
||||
|
||||
|
||||
/* Pipe pair doesn't use unix domain socket */
|
||||
/* Pipe pair use named pipe only, no uds support. */
|
||||
int uv_pipe(uv_file fds[2], int read_flags, int write_flags) {
|
||||
uv_file temp[2];
|
||||
int err;
|
||||
@ -447,7 +455,7 @@ int uv_pipe(uv_file fds[2], int read_flags, int write_flags) {
|
||||
}
|
||||
|
||||
|
||||
/* Pipe pair doesn't use unix domain socket */
|
||||
/* Pipe pair use named pipe only, no uds support. */
|
||||
int uv__create_stdio_pipe_pair(uv_loop_t* loop,
|
||||
uv_pipe_t* parent_pipe, HANDLE* child_pipe_ptr, unsigned int flags) {
|
||||
/* The parent_pipe is always the server_pipe and kept by libuv.
|
||||
|
||||
Loading…
Reference in New Issue
Block a user