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

Commit

Permalink
Upgrade libuv to ea63f06
Browse files Browse the repository at this point in the history
  • Loading branch information
piscisaureus committed Nov 24, 2011
1 parent a639cf7 commit 7244b9c
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 14 deletions.
1 change: 1 addition & 0 deletions deps/uv/src/unix/cygwin.c
Expand Up @@ -24,6 +24,7 @@
#include <stdint.h>
#include <stddef.h>
#include <errno.h>
#include <unistd.h>
#include <time.h>

#undef NANOSEC
Expand Down
2 changes: 1 addition & 1 deletion deps/uv/src/unix/fs.c
Expand Up @@ -518,11 +518,11 @@ static int _futime(const uv_file file, double atime, double mtime) {

int uv_fs_futime(uv_loop_t* loop, uv_fs_t* req, uv_file file, double atime,
double mtime, uv_fs_cb cb) {
#if HAVE_FUTIMES
const char* path = NULL;

uv_fs_req_init(loop, req, UV_FS_FUTIME, path, cb);

#if HAVE_FUTIMES
WRAP_EIO(UV_FS_FUTIME, eio_futime, _futime, ARGS3(file, atime, mtime))
#else
uv__set_sys_error(loop, ENOSYS);
Expand Down
4 changes: 4 additions & 0 deletions deps/uv/src/unix/internal.h
Expand Up @@ -27,6 +27,10 @@

#include <stddef.h> /* offsetof */

#if __STRICT_ANSI__
# define inline __inline
#endif

#undef HAVE_FUTIMES
#undef HAVE_PIPE2
#undef HAVE_ACCEPT4
Expand Down
40 changes: 28 additions & 12 deletions deps/uv/src/win/udp.c
Expand Up @@ -466,17 +466,31 @@ void uv_process_udp_recv_req(uv_loop_t* loop, uv_udp_t* handle,

handle->flags &= ~UV_HANDLE_READ_PENDING;

if (!REQ_SUCCESS(req) &&
GET_REQ_SOCK_ERROR(req) != WSAEMSGSIZE) {
/* An error occurred doing the read. */
if (handle->flags & UV_HANDLE_READING) {
uv__set_sys_error(loop, GET_REQ_SOCK_ERROR(req));
uv_udp_recv_stop(handle);
buf = (handle->flags & UV_HANDLE_ZERO_READ) ?
uv_buf_init(NULL, 0) : handle->recv_buffer;
handle->recv_cb(handle, -1, buf, NULL, 0);
if (!REQ_SUCCESS(req)) {
DWORD err = GET_REQ_SOCK_ERROR(req);
if (err == WSAEMSGSIZE) {
/* Not a real error, it just indicates that the received packet */
/* was bigger than the receive buffer. */
} else if (err == WSAECONNRESET || err == WSAENETRESET) {
/* A previous sendto operation failed; ignore this error. If */
/* zero-reading we need to call WSARecv/WSARecvFrom _without_ the */
/* MSG_PEEK flag to clear out the error queue. For nonzero reads, */
/* immediately queue a new receive. */
if (!(handle->flags & UV_HANDLE_ZERO_READ)) {
goto done;
}
} else {
/* A real error occurred. Report the error to the user only if we're */
/* currently reading. */
if (handle->flags & UV_HANDLE_READING) {
uv__set_sys_error(loop, err);
uv_udp_recv_stop(handle);
buf = (handle->flags & UV_HANDLE_ZERO_READ) ?
uv_buf_init(NULL, 0) : handle->recv_buffer;
handle->recv_cb(handle, -1, buf, NULL, 0);
}
goto done;
}
goto done;
}

if (!(handle->flags & UV_HANDLE_ZERO_READ)) {
Expand Down Expand Up @@ -527,8 +541,10 @@ void uv_process_udp_recv_req(uv_loop_t* loop, uv_udp_t* handle,
/* Kernel buffer empty */
uv__set_sys_error(loop, WSAEWOULDBLOCK);
handle->recv_cb(handle, 0, buf, NULL, 0);
} else {
/* Ouch! serious error. */
} else if (err != WSAECONNRESET && err != WSAENETRESET) {
/* Serious error. WSAECONNRESET/WSANETRESET is ignored because this */
/* just indicates that a previous sendto operation failed. */
uv_udp_recv_stop(handle);
uv__set_sys_error(loop, err);
handle->recv_cb(handle, -1, buf, NULL, 0);
}
Expand Down
4 changes: 3 additions & 1 deletion deps/uv/src/win/winsock.c
Expand Up @@ -144,6 +144,7 @@ int uv_ntstatus_to_winsock_error(NTSTATUS status) {
case STATUS_LINK_FAILED:
case STATUS_CONNECTION_DISCONNECTED:
case STATUS_PORT_UNREACHABLE:
case STATUS_HOPLIMIT_EXCEEDED:
return WSAECONNRESET;

case STATUS_LOCAL_DISCONNECT:
Expand Down Expand Up @@ -206,7 +207,8 @@ int uv_ntstatus_to_winsock_error(NTSTATUS status) {
return WSAEACCES;

default:
if (status & ((FACILITY_NTWIN32 << 16) | ERROR_SEVERITY_ERROR)) {
if ((status & (FACILITY_NTWIN32 << 16)) == (FACILITY_NTWIN32 << 16) &&
(status & (ERROR_SEVERITY_ERROR | ERROR_SEVERITY_WARNING))) {
/* It's a windows error that has been previously mapped to an */
/* ntstatus code. */
return (DWORD) (status & 0xffff);
Expand Down

0 comments on commit 7244b9c

Please sign in to comment.