src: getpeername getsockname
This commit is contained in:
parent
260f51cb67
commit
ca541f6799
@ -2940,6 +2940,15 @@ int uv_pipe_getsockname(const uv_pipe_t* handle, char* buffer, size_t* size) {
|
||||
if (buffer == NULL || size == NULL || *size == 0)
|
||||
return UV_EINVAL;
|
||||
|
||||
if (handle->flags & UV_HANDLE_WIN_UDS_PIPE) {
|
||||
if (handle->pathname != NULL) {
|
||||
*size = strlen(handle->pathname);
|
||||
memcpy(buffer, handle->pathname, *size);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (handle->flags & UV_HANDLE_BOUND)
|
||||
return uv__pipe_getname(handle, buffer, size);
|
||||
|
||||
@ -2961,6 +2970,15 @@ int uv_pipe_getpeername(const uv_pipe_t* handle, char* buffer, size_t* size) {
|
||||
if (handle->flags & UV_HANDLE_BOUND)
|
||||
return UV_ENOTCONN;
|
||||
|
||||
if (handle->flags & UV_HANDLE_WIN_UDS_PIPE) {
|
||||
if (handle->pathname != NULL) {
|
||||
*size = strlen(handle->pathname);
|
||||
memcpy(buffer, handle->pathname, *size);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (handle->handle != INVALID_HANDLE_VALUE)
|
||||
return uv__pipe_getname(handle, buffer, size);
|
||||
|
||||
@ -2993,6 +3011,11 @@ int uv_pipe_chmod(uv_pipe_t* handle, int mode) {
|
||||
if (handle == NULL || handle->handle == INVALID_HANDLE_VALUE)
|
||||
return UV_EBADF;
|
||||
|
||||
if (handle->flags & UV_HANDLE_WIN_UDS_PIPE) {
|
||||
/* Unix domain socket doesn't support this. */
|
||||
return UV_ENOSYS;
|
||||
}
|
||||
|
||||
if (mode != UV_READABLE &&
|
||||
mode != UV_WRITABLE &&
|
||||
mode != (UV_WRITABLE | UV_READABLE))
|
||||
|
||||
Loading…
Reference in New Issue
Block a user