Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

uv: upgrade to b88bc43

  • Loading branch information...
commit 986e61255736a74fad1d96cc928f049c93734e05 1 parent 57ddf5f
Ben Noordhuis bnoordhuis authored
34 deps/uv/include/uv.h
View
@@ -115,7 +115,8 @@ typedef intptr_t ssize_t;
XX( 45, EAISOCKTYPE, "") \
XX( 46, ESHUTDOWN, "") \
XX( 47, EEXIST, "file already exists") \
- XX( 48, ESRCH, "no such process")
+ XX( 48, ESRCH, "no such process") \
+ XX( 49, ENAMETOOLONG, "name too long")
#define UV_ERRNO_GEN(val, name, s) UV_##name = val,
@@ -632,6 +633,20 @@ UV_EXTERN int uv_udp_set_membership(uv_udp_t* handle,
uv_membership membership);
/*
+ * Set IP multicast loop flag. Makes multicast packets loop back to
+ * local sockets.
+ *
+ * Arguments:
+ * handle UDP handle. Should have been initialized with
+ * `uv_udp_init`.
+ * on 1 for on, 0 for off
+ *
+ * Returns:
+ * 0 on success, -1 on error.
+ */
+UV_EXTERN int uv_udp_set_multicast_loop(uv_udp_t* handle, int on);
+
+/*
* Set the multicast ttl
*
* Arguments:
@@ -642,7 +657,7 @@ UV_EXTERN int uv_udp_set_membership(uv_udp_t* handle,
* Returns:
* 0 on success, -1 on error.
*/
-int uv_udp_set_multicast_ttl(uv_udp_t* handle, int ttl);
+UV_EXTERN int uv_udp_set_multicast_ttl(uv_udp_t* handle, int ttl);
/*
* Set broadcast on or off
@@ -655,7 +670,20 @@ int uv_udp_set_multicast_ttl(uv_udp_t* handle, int ttl);
* Returns:
* 0 on success, -1 on error.
*/
-int uv_udp_set_broadcast(uv_udp_t* handle, int on);
+UV_EXTERN int uv_udp_set_broadcast(uv_udp_t* handle, int on);
+
+/*
+ * Set the time to live
+ *
+ * Arguments:
+ * handle UDP handle. Should have been initialized with
+ * `uv_udp_init`.
+ * ttl 1 through 255
+ *
+ * Returns:
+ * 0 on success, -1 on error.
+ */
+UV_EXTERN int uv_udp_set_ttl(uv_udp_t* handle, int ttl);
/*
* Send data. If the socket has not previously been bound with `uv_udp_bind`
1  deps/uv/src/unix/error.c
View
@@ -71,6 +71,7 @@ uv_err_code uv_translate_sys_error(int sys_errno) {
case EFAULT: return UV_EFAULT;
case EMFILE: return UV_EMFILE;
case EMSGSIZE: return UV_EMSGSIZE;
+ case ENAMETOOLONG: return UV_ENAMETOOLONG;
case EINVAL: return UV_EINVAL;
case ECONNREFUSED: return UV_ECONNREFUSED;
case EADDRINUSE: return UV_EADDRINUSE;
30 deps/uv/src/unix/udp.c
View
@@ -509,27 +509,25 @@ int uv_udp_set_membership(uv_udp_t* handle, const char* multicast_addr,
return 0;
}
-int uv_udp_set_multicast_ttl(uv_udp_t* handle, int ttl) {
- if (setsockopt(handle->fd, IPPROTO_IP, IP_MULTICAST_TTL, &ttl, sizeof ttl) == -1) {
- uv__set_sys_error(handle->loop, errno);
- return -1;
- }
-
- return 0;
-}
-int uv_udp_set_broadcast(uv_udp_t* handle, int on) {
- if (setsockopt(handle->fd, SOL_SOCKET, SO_BROADCAST, &on, sizeof on) == -1) {
- uv__set_sys_error(handle->loop, errno);
- return -1;
+#define X(name, level, option) \
+ int uv_udp_set_##name(uv_udp_t* handle, int flag) { \
+ if (setsockopt(handle->fd, level, option, &flag, sizeof(flag))) { \
+ uv__set_sys_error(handle->loop, errno); \
+ return -1; \
+ } \
+ return 0; \
}
- return 0;
-}
+X(multicast_loop, IPPROTO_IP, IP_MULTICAST_LOOP)
+X(multicast_ttl, IPPROTO_IP, IP_MULTICAST_TTL)
+X(broadcast, SOL_SOCKET, SO_BROADCAST)
+X(ttl, IPPROTO_IP, IP_TTL)
+
+#undef X
-int uv_udp_getsockname(uv_udp_t* handle, struct sockaddr* name,
- int* namelen) {
+int uv_udp_getsockname(uv_udp_t* handle, struct sockaddr* name, int* namelen) {
socklen_t socklen;
int saved_errno;
int rv = 0;
1  deps/uv/src/win/error.c
View
@@ -94,6 +94,7 @@ uv_err_code uv_translate_sys_error(int sys_errno) {
case WSAEMSGSIZE: return UV_EMSGSIZE;
case ERROR_NETWORK_UNREACHABLE: return UV_ENETUNREACH;
case WSAENETUNREACH: return UV_ENETUNREACH;
+ case WSAENOBUFS: return UV_ENOBUFS;
case ERROR_OUTOFMEMORY: return UV_ENOMEM;
case ERROR_NOT_CONNECTED: return UV_ENOTCONN;
case WSAENOTCONN: return UV_ENOTCONN;
28 deps/uv/src/win/tty.c
View
@@ -1069,13 +1069,26 @@ static int uv_tty_set_style(uv_tty_t* handle, DWORD* error) {
bg_bright = 0;
} else if (arg == 1) {
- /* Bright */
+ /* Foreground bright on */
fg_bright = 1;
+ } else if (arg == 2) {
+ /* Both bright off */
+ fg_bright = 0;
+ bg_bright = 0;
+
+ } else if (arg == 5) {
+ /* Background bright on */
+ bg_bright = 1;
+
} else if (arg == 21 || arg == 22) {
- /* Bright off. */
+ /* Foreground bright off */
fg_bright = 0;
+ } else if (arg == 25) {
+ /* Background bright off */
+ bg_bright = 0;
+
} else if (arg >= 30 && arg <= 37) {
/* Set foreground color */
fg_color = arg - 30;
@@ -1091,6 +1104,17 @@ static int uv_tty_set_style(uv_tty_t* handle, DWORD* error) {
} else if (arg == 49) {
/* Default background color */
bg_color = 0;
+
+ } else if (arg >= 90 && arg <= 97) {
+ /* Set bold foreground color */
+ fg_bright = 1;
+ fg_color = arg - 90;
+
+ } else if (arg >= 100 && arg <= 107) {
+ /* Set bold background color */
+ bg_bright = 1;
+ bg_color = arg - 100;
+
}
}
12 deps/uv/src/win/udp.c
View
@@ -579,6 +579,12 @@ void uv_process_udp_send_req(uv_loop_t* loop, uv_udp_t* handle,
}
+int uv_udp_set_multicast_loop(uv_udp_t* handle, int on) {
+ uv__set_artificial_error(handle->loop, UV_ENOSYS);
+ return -1;
+}
+
+
int uv_udp_set_multicast_ttl(uv_udp_t* handle, int ttl) {
if (setsockopt(handle->socket, IPPROTO_IP, IP_MULTICAST_TTL,
(const char*)&ttl, sizeof ttl) == -1) {
@@ -599,3 +605,9 @@ int uv_udp_set_broadcast(uv_udp_t* handle, int on) {
return 0;
}
+
+
+int uv_udp_set_ttl(uv_udp_t* handle, int ttl) {
+ uv__set_artificial_error(handle->loop, UV_ENOSYS);
+ return -1;
+}
36 deps/uv/test/test-fs.c
View
@@ -45,6 +45,7 @@
# define close _close
#endif
+#define TOO_LONG_NAME_LENGTH 8192
typedef struct {
const char* path;
@@ -416,6 +417,14 @@ static void open_noent_cb(uv_fs_t* req) {
uv_fs_req_cleanup(req);
}
+static void open_nametoolong_cb(uv_fs_t* req) {
+ ASSERT(req->fs_type == UV_FS_OPEN);
+ ASSERT(req->errorno == UV_ENAMETOOLONG);
+ ASSERT(req->result == -1);
+ open_cb_count++;
+ uv_fs_req_cleanup(req);
+}
+
TEST_IMPL(fs_file_noent) {
uv_fs_t req;
@@ -441,6 +450,31 @@ TEST_IMPL(fs_file_noent) {
return 0;
}
+TEST_IMPL(fs_file_nametoolong) {
+ uv_fs_t req;
+ int r;
+
+ loop = uv_default_loop();
+
+ char name[TOO_LONG_NAME_LENGTH + 1];
+ memset(name, 'a', TOO_LONG_NAME_LENGTH);
+ name[TOO_LONG_NAME_LENGTH] = 0;
+
+ r = uv_fs_open(loop, &req, name, O_RDONLY, 0, NULL);
+ ASSERT(r == -1);
+ ASSERT(req.result == -1);
+ ASSERT(uv_last_error(loop).code == UV_ENAMETOOLONG);
+ uv_fs_req_cleanup(&req);
+
+ r = uv_fs_open(loop, &req, name, O_RDONLY, 0, open_nametoolong_cb);
+ ASSERT(r == 0);
+
+ ASSERT(open_cb_count == 0);
+ uv_run(loop);
+ ASSERT(open_cb_count == 1);
+
+ return 0;
+}
static void check_utime(const char* path, double atime, double mtime) {
struct stat* s;
@@ -1543,4 +1577,4 @@ TEST_IMPL(fs_rename_to_existing_file) {
unlink("test_file2");
return 0;
-}
+}
2  deps/uv/test/test-list.h
View
@@ -103,6 +103,7 @@ TEST_DECLARE (spawn_and_kill)
TEST_DECLARE (spawn_and_ping)
TEST_DECLARE (kill)
TEST_DECLARE (fs_file_noent)
+TEST_DECLARE (fs_file_nametoolong)
TEST_DECLARE (fs_file_async)
TEST_DECLARE (fs_file_sync)
TEST_DECLARE (fs_async_dir)
@@ -269,6 +270,7 @@ TASK_LIST_START
#endif
TEST_ENTRY (fs_file_noent)
+ TEST_ENTRY (fs_file_nametoolong)
TEST_ENTRY (fs_file_async)
TEST_ENTRY (fs_file_sync)
TEST_ENTRY (fs_async_dir)
Please sign in to comment.
Something went wrong with that request. Please try again.