Browse Source

upgrade libuv to d68b3d960b6d95bfc16027cecca2f3fa48bcc36f

v0.8.7-release
Igor Zinkovsky 13 years ago
parent
commit
f178f2ae3f
  1. 9
      deps/uv/include/uv.h
  2. 31
      deps/uv/src/unix/fs.c
  3. 1
      deps/uv/src/win/error.c
  4. 13
      deps/uv/src/win/fs-event.c
  5. 88
      deps/uv/src/win/fs.c
  6. 5
      deps/uv/src/win/pipe.c
  7. 3
      deps/uv/src/win/tcp.c
  8. 7
      deps/uv/src/win/udp.c
  9. 106
      deps/uv/test/test-fs-event.c
  10. 35
      deps/uv/test/test-fs.c
  11. 6
      deps/uv/test/test-list.h
  12. 28
      deps/uv/test/test-pipe-connect-error.c
  13. 1
      deps/uv/uv.gyp

9
deps/uv/include/uv.h

@ -1155,12 +1155,18 @@ UV_EXTERN int uv_fs_open(uv_loop_t* loop, uv_fs_t* req, const char* path,
UV_EXTERN int uv_fs_read(uv_loop_t* loop, uv_fs_t* req, uv_file file,
void* buf, size_t length, off_t offset, uv_fs_cb cb);
int uv_fs_read64(uv_loop_t* loop, uv_fs_t* req, uv_file file,
void* buf, size_t length, int64_t offset, uv_fs_cb cb);
UV_EXTERN int uv_fs_unlink(uv_loop_t* loop, uv_fs_t* req, const char* path,
uv_fs_cb cb);
UV_EXTERN int uv_fs_write(uv_loop_t* loop, uv_fs_t* req, uv_file file,
void* buf, size_t length, off_t offset, uv_fs_cb cb);
int uv_fs_write64(uv_loop_t* loop, uv_fs_t* req, uv_file file,
void* buf, size_t length, int64_t offset, uv_fs_cb cb);
UV_EXTERN int uv_fs_mkdir(uv_loop_t* loop, uv_fs_t* req, const char* path,
int mode, uv_fs_cb cb);
@ -1188,6 +1194,9 @@ UV_EXTERN int uv_fs_fdatasync(uv_loop_t* loop, uv_fs_t* req, uv_file file,
UV_EXTERN int uv_fs_ftruncate(uv_loop_t* loop, uv_fs_t* req, uv_file file,
off_t offset, uv_fs_cb cb);
int uv_fs_ftruncate64(uv_loop_t* loop, uv_fs_t* req, uv_file file,
int64_t offset, uv_fs_cb cb);
UV_EXTERN int uv_fs_sendfile(uv_loop_t* loop, uv_fs_t* req, uv_file out_fd,
uv_file in_fd, off_t in_offset, size_t length, uv_fs_cb cb);

31
deps/uv/src/unix/fs.c

@ -701,3 +701,34 @@ int uv_queue_work(uv_loop_t* loop, uv_work_t* req, uv_work_cb work_cb,
return 0;
}
int uv_fs_read64(uv_loop_t* loop,
uv_fs_t* req,
uv_file file,
void* buf,
size_t length,
int64_t offset,
uv_fs_cb cb) {
return uv_fs_read(loop, req, file, buf, length, offset, cb);
}
int uv_fs_write64(uv_loop_t* loop,
uv_fs_t* req,
uv_file file,
void* buf,
size_t length,
int64_t offset,
uv_fs_cb cb) {
return uv_fs_write(loop, req, file, buf, length, offset, cb);
}
int uv_fs_ftruncate64(uv_loop_t* loop,
uv_fs_t* req,
uv_file file,
int64_t offset,
uv_fs_cb cb) {
return uv_fs_ftruncate(loop, req, file, offset, cb);
}

1
deps/uv/src/win/error.c

@ -125,6 +125,7 @@ uv_err_code uv_translate_sys_error(int sys_errno) {
case ERROR_SEM_TIMEOUT: return UV_ETIMEDOUT;
case WSAETIMEDOUT: return UV_ETIMEDOUT;
case WSAHOST_NOT_FOUND: return UV_ENOENT;
case WSAENOTSOCK: return UV_ENOTSOCK;
default: return UV_UNKNOWN;
}
}

13
deps/uv/src/win/fs-event.c

@ -301,6 +301,13 @@ void uv_process_fs_event_req(uv_loop_t* loop, uv_req_t* req,
assert(handle->req_pending);
handle->req_pending = 0;
/* If we're closing, don't report any callbacks, and just push the handle */
/* onto the endgame queue. */
if (handle->flags & UV_HANDLE_CLOSING) {
uv_want_endgame(loop, (uv_handle_t*) handle);
return;
};
file_info = (FILE_NOTIFY_INFORMATION*)(handle->buffer + offset);
if (REQ_SUCCESS(req)) {
@ -438,11 +445,9 @@ void uv_process_fs_event_req(uv_loop_t* loop, uv_req_t* req,
}
offset = file_info->NextEntryOffset;
} while(offset);
} while (offset && !(handle->flags & UV_HANDLE_CLOSING));
} else {
if (!(handle->flags & UV_HANDLE_CLOSING)) {
handle->cb(handle, NULL, UV_CHANGE, 0);
}
handle->cb(handle, NULL, UV_CHANGE, 0);
}
} else {
uv__set_sys_error(loop, GET_REQ_ERROR(req));

88
deps/uv/src/win/fs.c

@ -33,12 +33,11 @@
#include "uv.h"
#include "internal.h"
#define UV_FS_ASYNC_QUEUED 0x0001
#define UV_FS_FREE_ARG0 0x0002
#define UV_FS_FREE_ARG1 0x0004
#define UV_FS_FREE_PTR 0x0008
#define UV_FS_CLEANEDUP 0x0010
#define UV_FS_ASYNC_QUEUED 0x0001
#define UV_FS_FREE_ARG0 0x0002
#define UV_FS_FREE_ARG1 0x0004
#define UV_FS_FREE_PTR 0x0008
#define UV_FS_CLEANEDUP 0x0010
#define UTF8_TO_UTF16(s, t) \
size = uv_utf8_to_utf16(s, NULL, 0) * sizeof(wchar_t); \
@ -289,7 +288,7 @@ void fs__close(uv_fs_t* req, uv_file file) {
void fs__read(uv_fs_t* req, uv_file file, void *buf, size_t length,
off_t offset) {
int64_t offset) {
HANDLE handle;
OVERLAPPED overlapped, *overlapped_ptr;
LARGE_INTEGER offset_;
@ -335,7 +334,7 @@ void fs__read(uv_fs_t* req, uv_file file, void *buf, size_t length,
void fs__write(uv_fs_t* req, uv_file file, void *buf, size_t length,
off_t offset) {
int64_t offset) {
HANDLE handle;
OVERLAPPED overlapped, *overlapped_ptr;
LARGE_INTEGER offset_;
@ -597,12 +596,12 @@ void fs__fsync(uv_fs_t* req, uv_file file) {
}
void fs__ftruncate(uv_fs_t* req, uv_file file, off_t offset) {
void fs__ftruncate(uv_fs_t* req, uv_file file, int64_t offset) {
int result;
VERIFY_UV_FILE(file, req);
result = _chsize(file, offset);
result = _chsize_s(file, offset);
SET_REQ_RESULT(req, result);
}
@ -878,14 +877,14 @@ static DWORD WINAPI uv_fs_thread_proc(void* parameter) {
(uv_file) req->arg0,
req->arg1,
(size_t) req->arg2,
(off_t) req->arg3);
req->stat.st_atime);
break;
case UV_FS_WRITE:
fs__write(req,
(uv_file)req->arg0,
req->arg1,
(size_t) req->arg2,
(off_t) req->arg3);
req->stat.st_atime);
break;
case UV_FS_UNLINK:
fs__unlink(req, req->pathw);
@ -914,7 +913,7 @@ static DWORD WINAPI uv_fs_thread_proc(void* parameter) {
fs__fsync(req, (uv_file)req->arg0);
break;
case UV_FS_FTRUNCATE:
fs__ftruncate(req, (uv_file)req->arg0, (off_t)req->arg1);
fs__ftruncate(req, (uv_file)req->arg0, (off_t)req->stat.st_atime);
break;
case UV_FS_SENDFILE:
fs__sendfile(req,
@ -1002,7 +1001,26 @@ int uv_fs_read(uv_loop_t* loop, uv_fs_t* req, uv_file file, void* buf,
size_t length, off_t offset, uv_fs_cb cb) {
if (cb) {
uv_fs_req_init_async(loop, req, UV_FS_READ, NULL, NULL, cb);
WRAP_REQ_ARGS4(req, file, buf, length, offset);
WRAP_REQ_ARGS3(req, file, buf, length);
req->stat.st_atime = offset;
QUEUE_FS_TP_JOB(loop, req);
} else {
uv_fs_req_init_sync(loop, req, UV_FS_READ);
fs__read(req, file, buf, length, offset);
SET_UV_LAST_ERROR_FROM_REQ(req);
return req->result;
}
return 0;
}
int uv_fs_read64(uv_loop_t* loop, uv_fs_t* req, uv_file file, void* buf,
size_t length, int64_t offset, uv_fs_cb cb) {
if (cb) {
uv_fs_req_init_async(loop, req, UV_FS_READ, NULL, NULL, cb);
WRAP_REQ_ARGS3(req, file, buf, length);
req->stat.st_atime = offset;
QUEUE_FS_TP_JOB(loop, req);
} else {
uv_fs_req_init_sync(loop, req, UV_FS_READ);
@ -1019,7 +1037,26 @@ int uv_fs_write(uv_loop_t* loop, uv_fs_t* req, uv_file file, void* buf,
size_t length, off_t offset, uv_fs_cb cb) {
if (cb) {
uv_fs_req_init_async(loop, req, UV_FS_WRITE, NULL, NULL, cb);
WRAP_REQ_ARGS4(req, file, buf, length, offset);
WRAP_REQ_ARGS3(req, file, buf, length);
req->stat.st_atime = offset;
QUEUE_FS_TP_JOB(loop, req);
} else {
uv_fs_req_init_sync(loop, req, UV_FS_WRITE);
fs__write(req, file, buf, length, offset);
SET_UV_LAST_ERROR_FROM_REQ(req);
return req->result;
}
return 0;
}
int uv_fs_write64(uv_loop_t* loop, uv_fs_t* req, uv_file file, void* buf,
size_t length, int64_t offset, uv_fs_cb cb) {
if (cb) {
uv_fs_req_init_async(loop, req, UV_FS_WRITE, NULL, NULL, cb);
WRAP_REQ_ARGS3(req, file, buf, length);
req->stat.st_atime = offset;
QUEUE_FS_TP_JOB(loop, req);
} else {
uv_fs_req_init_sync(loop, req, UV_FS_WRITE);
@ -1412,7 +1449,26 @@ int uv_fs_ftruncate(uv_loop_t* loop, uv_fs_t* req, uv_file file,
off_t offset, uv_fs_cb cb) {
if (cb) {
uv_fs_req_init_async(loop, req, UV_FS_FTRUNCATE, NULL, NULL, cb);
WRAP_REQ_ARGS2(req, file, offset);
WRAP_REQ_ARGS1(req, file);
req->stat.st_atime = offset;
QUEUE_FS_TP_JOB(loop, req);
} else {
uv_fs_req_init_sync(loop, req, UV_FS_FTRUNCATE);
fs__ftruncate(req, file, offset);
SET_UV_LAST_ERROR_FROM_REQ(req);
return req->result;
}
return 0;
}
int uv_fs_ftruncate64(uv_loop_t* loop, uv_fs_t* req, uv_file file,
int64_t offset, uv_fs_cb cb) {
if (cb) {
uv_fs_req_init_async(loop, req, UV_FS_FTRUNCATE, NULL, NULL, cb);
WRAP_REQ_ARGS1(req, file);
req->stat.st_atime = offset;
QUEUE_FS_TP_JOB(loop, req);
} else {
uv_fs_req_init_sync(loop, req, UV_FS_FTRUNCATE);

5
deps/uv/src/win/pipe.c

@ -217,6 +217,11 @@ static int uv_set_pipe_handle(uv_loop_t* loop, uv_pipe_t* handle,
DWORD mode = PIPE_TYPE_BYTE | PIPE_READMODE_BYTE | PIPE_WAIT;
if (!SetNamedPipeHandleState(pipeHandle, &mode, NULL, NULL)) {
/* If this returns ERROR_INVALID_PARAMETER we probably opened something */
/* that is not a pipe. */
if (GetLastError() == ERROR_INVALID_PARAMETER) {
SetLastError(WSAENOTSOCK);
}
return -1;
}

3
deps/uv/src/win/tcp.c

@ -239,10 +239,9 @@ static int uv__bind(uv_tcp_t* handle,
int addrsize) {
DWORD err;
int r;
SOCKET sock;
if (handle->socket == INVALID_SOCKET) {
sock = socket(domain, SOCK_STREAM, 0);
SOCKET sock = socket(domain, SOCK_STREAM, 0);
if (sock == INVALID_SOCKET) {
uv__set_sys_error(handle->loop, WSAGetLastError());
return -1;

7
deps/uv/src/win/udp.c

@ -167,7 +167,6 @@ static int uv__bind(uv_udp_t* handle,
int addrsize,
unsigned int flags) {
int r;
SOCKET sock;
DWORD no = 0, yes = 1;
if ((flags & UV_UDP_IPV6ONLY) && domain != AF_INET6) {
@ -177,7 +176,7 @@ static int uv__bind(uv_udp_t* handle,
}
if (handle->socket == INVALID_SOCKET) {
sock = socket(domain, SOCK_DGRAM, 0);
SOCKET sock = socket(domain, SOCK_DGRAM, 0);
if (sock == INVALID_SOCKET) {
uv__set_sys_error(handle->loop, WSAGetLastError());
return -1;
@ -196,14 +195,14 @@ static int uv__bind(uv_udp_t* handle,
/* TODO: how to handle errors? This may fail if there is no ipv4 stack */
/* available, or when run on XP/2003 which have no support for dualstack */
/* sockets. For now we're silently ignoring the error. */
setsockopt(sock,
setsockopt(handle->socket,
IPPROTO_IPV6,
IPV6_V6ONLY,
(char*) &no,
sizeof no);
}
r = setsockopt(sock,
r = setsockopt(handle->socket,
SOL_SOCKET,
SO_REUSEADDR,
(char*) &yes,

106
deps/uv/test/test-fs-event.c

@ -27,16 +27,16 @@
static uv_fs_event_t fs_event;
static uv_timer_t timer;
static int timer_cb_called;
static int close_cb_called;
static int fs_event_cb_called;
static int timer_cb_touch_called;
static int timer_cb_called = 0;
static int close_cb_called = 0;
static int fs_event_cb_called = 0;
static int timer_cb_touch_called = 0;
static void create_dir(uv_loop_t* loop, const char* name) {
int r;
uv_fs_t req;
r = uv_fs_mkdir(loop, &req, name, 0755, NULL);
ASSERT(r == 0);
ASSERT(r == 0 || uv_last_error(loop).code == UV_EEXIST);
uv_fs_req_cleanup(&req);
}
@ -117,7 +117,7 @@ static void timer_cb_dir(uv_timer_t* handle, int status) {
static void timer_cb_file(uv_timer_t* handle, int status) {
++timer_cb_called;
if (timer_cb_called == 1) {
touch_file(handle->loop, "watch_dir/file1");
} else {
@ -271,7 +271,7 @@ TEST_IMPL(fs_event_no_callback_on_close) {
static void fs_event_fail(uv_fs_event_t* handle, const char* filename,
int events, int status) {
int events, int status) {
ASSERT(0 && "should never be called");
}
@ -308,3 +308,95 @@ TEST_IMPL(fs_event_immediate_close) {
return 0;
}
TEST_IMPL(fs_event_close_with_pending_event) {
uv_loop_t* loop;
uv_fs_t fs_req;
int r;
loop = uv_default_loop();
create_dir(loop, "watch_dir");
create_file(loop, "watch_dir/file");
r = uv_fs_event_init(loop, &fs_event, "watch_dir", fs_event_fail, 0);
ASSERT(r == 0);
/* Generate an fs event. */
touch_file(loop, "watch_dir/file");
uv_close((uv_handle_t*)&fs_event, close_cb);
uv_run(loop);
ASSERT(close_cb_called == 1);
/* Clean up */
r = uv_fs_unlink(loop, &fs_req, "watch_dir/file", NULL);
ASSERT(r == 0);
r = uv_fs_rmdir(loop, &fs_req, "watch_dir", NULL);
ASSERT(r == 0);
return 0;
}
static void fs_event_cb_close(uv_fs_event_t* handle, const char* filename,
int events, int status) {
ASSERT(status == 0);
ASSERT(fs_event_cb_called < 3);
++fs_event_cb_called;
if (fs_event_cb_called == 3) {
uv_close((uv_handle_t*) handle, close_cb);
}
}
TEST_IMPL(fs_event_close_in_callback) {
uv_loop_t* loop;
uv_fs_t fs_req;
int r;
loop = uv_default_loop();
create_dir(loop, "watch_dir");
create_file(loop, "watch_dir/file1");
create_file(loop, "watch_dir/file2");
create_file(loop, "watch_dir/file3");
create_file(loop, "watch_dir/file4");
create_file(loop, "watch_dir/file5");
r = uv_fs_event_init(loop, &fs_event, "watch_dir", fs_event_cb_close, 0);
ASSERT(r == 0);
/* Generate a couple of fs events. */
touch_file(loop, "watch_dir/file1");
touch_file(loop, "watch_dir/file2");
touch_file(loop, "watch_dir/file3");
touch_file(loop, "watch_dir/file4");
touch_file(loop, "watch_dir/file5");
uv_run(loop);
ASSERT(close_cb_called == 1);
ASSERT(fs_event_cb_called == 3);
/* Clean up */
r = uv_fs_unlink(loop, &fs_req, "watch_dir/file1", NULL);
ASSERT(r == 0);
r = uv_fs_unlink(loop, &fs_req, "watch_dir/file2", NULL);
ASSERT(r == 0);
r = uv_fs_unlink(loop, &fs_req, "watch_dir/file3", NULL);
ASSERT(r == 0);
r = uv_fs_unlink(loop, &fs_req, "watch_dir/file4", NULL);
ASSERT(r == 0);
r = uv_fs_unlink(loop, &fs_req, "watch_dir/file5", NULL);
ASSERT(r == 0);
r = uv_fs_rmdir(loop, &fs_req, "watch_dir", NULL);
ASSERT(r == 0);
return 0;
}

35
deps/uv/test/test-fs.c

@ -248,6 +248,11 @@ static void read_cb(uv_fs_t* req) {
read_cb_count++;
uv_fs_req_cleanup(req);
if (read_cb_count == 1) {
ASSERT(strcmp(buf, test_buf) == 0);
memset(buf, 0, sizeof(buf));
r = uv_fs_read64(loop, &read_req, open_req1.result, buf, sizeof(buf), 0,
read_cb);
} else if (read_cb_count == 2) {
ASSERT(strcmp(buf, test_buf) == 0);
r = uv_fs_ftruncate(loop, &ftruncate_req, open_req1.result, 7,
ftruncate_cb);
@ -319,7 +324,13 @@ static void write_cb(uv_fs_t* req) {
ASSERT(req->result != -1);
write_cb_count++;
uv_fs_req_cleanup(req);
r = uv_fs_fdatasync(loop, &fdatasync_req, open_req1.result, fdatasync_cb);
if (write_cb_count == 1) {
r = uv_fs_write64(loop, &write_req, open_req1.result, test_buf, sizeof(test_buf),
-1, write_cb);
} else {
r = uv_fs_fdatasync(loop, &fdatasync_req, open_req1.result, fdatasync_cb);
}
}
@ -596,7 +607,7 @@ TEST_IMPL(fs_file_async) {
uv_run(loop);
ASSERT(create_cb_count == 1);
ASSERT(write_cb_count == 1);
ASSERT(write_cb_count == 2);
ASSERT(fsync_cb_count == 1);
ASSERT(fdatasync_cb_count == 1);
ASSERT(close_cb_count == 1);
@ -606,7 +617,7 @@ TEST_IMPL(fs_file_async) {
uv_run(loop);
ASSERT(create_cb_count == 1);
ASSERT(write_cb_count == 1);
ASSERT(write_cb_count == 2);
ASSERT(close_cb_count == 1);
ASSERT(rename_cb_count == 1);
@ -615,11 +626,11 @@ TEST_IMPL(fs_file_async) {
uv_run(loop);
ASSERT(open_cb_count == 1);
ASSERT(read_cb_count == 1);
ASSERT(read_cb_count == 2);
ASSERT(close_cb_count == 2);
ASSERT(rename_cb_count == 1);
ASSERT(create_cb_count == 1);
ASSERT(write_cb_count == 1);
ASSERT(write_cb_count == 2);
ASSERT(ftruncate_cb_count == 1);
r = uv_fs_open(loop, &open_req1, "test_file2", O_RDONLY, 0, open_cb);
@ -627,12 +638,12 @@ TEST_IMPL(fs_file_async) {
uv_run(loop);
ASSERT(open_cb_count == 2);
ASSERT(read_cb_count == 2);
ASSERT(read_cb_count == 3);
ASSERT(close_cb_count == 3);
ASSERT(rename_cb_count == 1);
ASSERT(unlink_cb_count == 1);
ASSERT(create_cb_count == 1);
ASSERT(write_cb_count == 1);
ASSERT(write_cb_count == 2);
ASSERT(ftruncate_cb_count == 1);
/* Cleanup. */
@ -681,6 +692,14 @@ TEST_IMPL(fs_file_sync) {
ASSERT(strcmp(buf, test_buf) == 0);
uv_fs_req_cleanup(&read_req);
memset(buf, 0, sizeof(buf));
r = uv_fs_read64(loop, &read_req, open_req1.result, buf, sizeof(buf), 0,
NULL);
ASSERT(r != -1);
ASSERT(read_req.result != -1);
ASSERT(strcmp(buf, test_buf) == 0);
uv_fs_req_cleanup(&read_req);
r = uv_fs_ftruncate(loop, &ftruncate_req, open_req1.result, 7, NULL);
ASSERT(r != -1);
ASSERT(ftruncate_req.result != -1);
@ -899,7 +918,7 @@ TEST_IMPL(fs_fstat) {
file = req.result;
uv_fs_req_cleanup(&req);
r = uv_fs_write(loop, &req, file, test_buf, sizeof(test_buf), -1, NULL);
r = uv_fs_write64(loop, &req, file, test_buf, sizeof(test_buf), -1, NULL);
ASSERT(r == sizeof(test_buf));
ASSERT(req.result == sizeof(test_buf));
uv_fs_req_cleanup(&req);

6
deps/uv/test/test-list.h

@ -57,6 +57,7 @@ TEST_DECLARE (pipe_bind_error_addrnotavail)
TEST_DECLARE (pipe_bind_error_inval)
TEST_DECLARE (pipe_listen_without_bind)
TEST_DECLARE (pipe_connect_bad_name)
TEST_DECLARE (pipe_connect_to_file)
TEST_DECLARE (connection_fail)
TEST_DECLARE (connection_fail_doesnt_auto_close)
TEST_DECLARE (shutdown_close_tcp)
@ -131,6 +132,8 @@ TEST_DECLARE (fs_event_watch_file)
TEST_DECLARE (fs_event_watch_file_current_dir)
TEST_DECLARE (fs_event_no_callback_on_close)
TEST_DECLARE (fs_event_immediate_close)
TEST_DECLARE (fs_event_close_with_pending_event)
TEST_DECLARE (fs_event_close_in_callback);
TEST_DECLARE (fs_readdir_empty_dir)
TEST_DECLARE (fs_readdir_file)
TEST_DECLARE (fs_open_dir)
@ -153,6 +156,7 @@ HELPER_DECLARE (pipe_echo_server)
TASK_LIST_START
TEST_ENTRY (pipe_connect_bad_name)
TEST_ENTRY (pipe_connect_to_file)
TEST_ENTRY (tty)
TEST_ENTRY (stdio_over_pipes)
@ -315,6 +319,8 @@ TASK_LIST_START
TEST_ENTRY (fs_event_watch_file_current_dir)
TEST_ENTRY (fs_event_no_callback_on_close)
TEST_ENTRY (fs_event_immediate_close)
TEST_ENTRY (fs_event_close_with_pending_event)
TEST_ENTRY (fs_event_close_in_callback)
TEST_ENTRY (fs_readdir_empty_dir)
TEST_ENTRY (fs_readdir_file)
TEST_ENTRY (fs_open_dir)

28
deps/uv/test/test-pipe-connect-error.c

@ -50,6 +50,15 @@ static void connect_cb(uv_connect_t* connect_req, int status) {
}
static void connect_cb_file(uv_connect_t* connect_req, int status) {
ASSERT(status == -1);
ASSERT(uv_last_error(uv_default_loop()).code == UV_ENOTSOCK ||
uv_last_error(uv_default_loop()).code == UV_ECONNREFUSED);
uv_close((uv_handle_t*)connect_req->handle, close_cb);
connect_cb_called++;
}
TEST_IMPL(pipe_connect_bad_name) {
uv_pipe_t client;
uv_connect_t req;
@ -66,3 +75,22 @@ TEST_IMPL(pipe_connect_bad_name) {
return 0;
}
TEST_IMPL(pipe_connect_to_file) {
const char* path = "test/fixtures/empty_file";
uv_pipe_t client;
uv_connect_t req;
int r;
r = uv_pipe_init(uv_default_loop(), &client, 0);
ASSERT(r == 0);
uv_pipe_connect(&req, &client, path, connect_cb_file);
uv_run(uv_default_loop());
ASSERT(close_cb_called == 1);
ASSERT(connect_cb_called == 1);
return 0;
}

1
deps/uv/uv.gyp

@ -208,6 +208,7 @@
],
},
'defines': [
'_DARWIN_USE_64_BIT_INODE=1',
'EV_CONFIG_H="config_darwin.h"',
'EIO_CONFIG_H="config_darwin.h"',
]

Loading…
Cancel
Save