Skip to content
This repository has been archived by the owner on Apr 22, 2023. It is now read-only.

Commit

Permalink
Update uv to 5d21056
Browse files Browse the repository at this point in the history
  • Loading branch information
isaacs committed Mar 14, 2012
1 parent c834ef4 commit ad5a108
Show file tree
Hide file tree
Showing 21 changed files with 447 additions and 148 deletions.
2 changes: 2 additions & 0 deletions deps/uv/src/win/error.c
Expand Up @@ -91,6 +91,8 @@ uv_err_code uv_translate_sys_error(int sys_errno) {
case WSAEFAULT: return UV_EFAULT;
case ERROR_HOST_UNREACHABLE: return UV_EHOSTUNREACH;
case WSAEHOSTUNREACH: return UV_EHOSTUNREACH;
case ERROR_OPERATION_ABORTED: return UV_EINTR;
case WSAEINTR: return UV_EINTR;
case ERROR_INVALID_DATA: return UV_EINVAL;
case WSAEINVAL: return UV_EINVAL;
case ERROR_CANT_RESOLVE_FILENAME: return UV_ELOOP;
Expand Down
3 changes: 2 additions & 1 deletion deps/uv/src/win/fs.c
Expand Up @@ -547,7 +547,8 @@ static void fs__stat(uv_fs_t* req, const wchar_t* path) {
req->stat.st_size = ((int64_t) info.nFileSizeHigh << 32) +
(int64_t) info.nFileSizeLow;

req->stat.st_nlink = info.nNumberOfLinks;
req->stat.st_nlink = (info.nNumberOfLinks <= SHRT_MAX) ?
(short) info.nNumberOfLinks : SHRT_MAX;

req->ptr = &req->stat;
req->result = 0;
Expand Down
15 changes: 11 additions & 4 deletions deps/uv/src/win/handle.c
Expand Up @@ -27,9 +27,15 @@


uv_handle_type uv_guess_handle(uv_file file) {
HANDLE handle = (HANDLE) _get_osfhandle(file);
HANDLE handle;
DWORD mode;

if (file < 0) {
return UV_UNKNOWN_HANDLE;
}

handle = (HANDLE) _get_osfhandle(file);

switch (GetFileType(handle)) {
case FILE_TYPE_CHAR:
if (GetConsoleMode(handle, &mode)) {
Expand Down Expand Up @@ -85,9 +91,10 @@ void uv_close(uv_handle_t* handle, uv_close_cb cb) {
tcp = (uv_tcp_t*)handle;
/* If we don't shutdown before calling closesocket, windows will */
/* silently discard the kernel send buffer and reset the connection. */
if (!(tcp->flags & UV_HANDLE_SHUT)) {
if ((tcp->flags & UV_HANDLE_CONNECTION) &&
!(tcp->flags & UV_HANDLE_SHUT)) {
shutdown(tcp->socket, SD_SEND);
tcp->flags |= UV_HANDLE_SHUT;
tcp->flags |= UV_HANDLE_SHUTTING | UV_HANDLE_SHUT;
}
tcp->flags &= ~(UV_HANDLE_READING | UV_HANDLE_LISTENING);
closesocket(tcp->socket);
Expand Down Expand Up @@ -173,7 +180,7 @@ void uv_want_endgame(uv_loop_t* loop, uv_handle_t* handle) {
void uv_process_endgames(uv_loop_t* loop) {
uv_handle_t* handle;

while (loop->endgame_handles) {
while (loop->endgame_handles && loop->refs > 0) {
handle = loop->endgame_handles;
loop->endgame_handles = handle->endgame_next;

Expand Down

0 comments on commit ad5a108

Please sign in to comment.