Navigation Menu

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

Commit

Permalink
uv: upgrade to 28234d7
Browse files Browse the repository at this point in the history
  • Loading branch information
bnoordhuis committed Oct 20, 2011
1 parent be2320d commit 145aa63
Show file tree
Hide file tree
Showing 21 changed files with 1,030 additions and 130 deletions.
2 changes: 2 additions & 0 deletions deps/uv/AUTHORS
Expand Up @@ -29,3 +29,5 @@ Fedor Indutny <fedor.indutny@gmail.com>
Saúl Ibarra Corretgé <saghul@gmail.com>
Felix Geisendörfer <felix@debuggable.com>
Yuki OKUMURA <mjt@cltn.org>
Roman Shtylman <shtylman@gmail.com>
Frank DENIS <github@pureftpd.org>
43 changes: 38 additions & 5 deletions deps/uv/include/uv-private/uv-win.h
Expand Up @@ -104,6 +104,27 @@
DWORD dwFlags);
#endif

typedef int (WSAAPI* LPFN_WSARECV)
(SOCKET socket,
LPWSABUF buffers,
DWORD buffer_count,
LPDWORD bytes,
LPDWORD flags,
LPWSAOVERLAPPED overlapped,
LPWSAOVERLAPPED_COMPLETION_ROUTINE
completion_routine);

typedef int (WSAAPI* LPFN_WSARECVFROM)
(SOCKET socket,
LPWSABUF buffers,
DWORD buffer_count,
LPDWORD bytes,
LPDWORD flags,
struct sockaddr* addr,
LPINT addr_len,
LPWSAOVERLAPPED overlapped,
LPWSAOVERLAPPED_COMPLETION_ROUTINE completion_routine);


/**
* It should be possible to cast uv_buf_t[] to WSABUF[]
Expand Down Expand Up @@ -169,7 +190,10 @@ RB_HEAD(uv_timer_tree_s, uv_timer_s);
struct uv_req_s* next_req;

#define UV_WRITE_PRIVATE_FIELDS \
int ipc_header;
int ipc_header; \
uv_buf_t write_buffer; \
HANDLE event_handle; \
HANDLE wait_handle;

#define UV_CONNECT_PRIVATE_FIELDS \
/* empty */
Expand All @@ -194,7 +218,13 @@ RB_HEAD(uv_timer_tree_s, uv_timer_s);
HANDLE event_handle; \
HANDLE wait_handle; \
struct uv_tcp_accept_s* next_pending; \
} uv_tcp_accept_t;
} uv_tcp_accept_t; \
\
typedef struct uv_read_s { \
UV_REQ_FIELDS \
HANDLE event_handle; \
HANDLE wait_handle; \
} uv_read_t;

#define uv_stream_connection_fields \
unsigned int write_reqs_pending; \
Expand All @@ -205,7 +235,7 @@ RB_HEAD(uv_timer_tree_s, uv_timer_s);

#define UV_STREAM_PRIVATE_FIELDS \
unsigned int reqs_pending; \
uv_req_t read_req; \
uv_read_t read_req; \
union { \
struct { uv_stream_connection_fields }; \
struct { uv_stream_server_fields }; \
Expand Down Expand Up @@ -236,7 +266,9 @@ RB_HEAD(uv_timer_tree_s, uv_timer_s);
struct sockaddr_storage recv_from; \
int recv_from_len; \
uv_udp_recv_cb recv_cb; \
uv_alloc_cb alloc_cb;
uv_alloc_cb alloc_cb; \
LPFN_WSARECV func_wsarecv; \
LPFN_WSARECVFROM func_wsarecvfrom;

#define uv_pipe_server_fields \
uv_pipe_accept_t accept_reqs[4]; \
Expand All @@ -247,7 +279,8 @@ RB_HEAD(uv_timer_tree_s, uv_timer_s);
uv_write_t ipc_header_write_req; \
int ipc_pid; \
uint64_t remaining_ipc_rawdata_bytes; \
WSAPROTOCOL_INFOW* pending_socket_info;
WSAPROTOCOL_INFOW* pending_socket_info; \
uv_write_t* non_overlapped_writes_tail;

#define UV_PIPE_PRIVATE_FIELDS \
HANDLE handle; \
Expand Down
4 changes: 2 additions & 2 deletions deps/uv/include/uv.h
Expand Up @@ -610,7 +610,7 @@ int uv_udp_send6(uv_udp_send_t* req, uv_udp_t* handle, uv_buf_t bufs[],
int bufcnt, struct sockaddr_in6 addr, uv_udp_send_cb send_cb);

/*
* Send data. If the socket has not previously been bound with `uv_udp_bind`
* Receive data. If the socket has not previously been bound with `uv_udp_bind`
* or `uv_udp_bind6`, it is bound to 0.0.0.0 (the "all interfaces" address)
* and a random port number.
*
Expand Down Expand Up @@ -1061,7 +1061,7 @@ int uv_fs_lstat(uv_loop_t* loop, uv_fs_t* req, const char* path, uv_fs_cb cb);
int uv_fs_link(uv_loop_t* loop, uv_fs_t* req, const char* path,
const char* new_path, uv_fs_cb cb);

/*
/*
* This flag can be used with uv_fs_symlink on Windows
* to specify whether path argument points to a directory.
*/
Expand Down
21 changes: 12 additions & 9 deletions deps/uv/src/ares/ares_init.c
Expand Up @@ -696,17 +696,20 @@ static int get_iphlpapi_dns_info (char *ret_buf, size_t ret_size)
struct sockaddr_in6 *pIPv6Addr = ( struct sockaddr_in6 * ) pGenericAddr;
ares_inet_ntop( AF_INET6, &pIPv6Addr->sin6_addr, ret, ipv6_size - 1 ); /* -1 for comma */

/* Append a comma to the end, THEN NULL. Should be OK because we
already tested the size at the top of the if statement. */
stringlen = strlen( ret );
ret[ stringlen ] = ',';
ret[ stringlen + 1 ] = '\0';
ret += stringlen + 1;
left -= ret - ret_buf;
++count;

/* NB on Windows this also returns stuff in the fec0::/10 range,
seems to be hard-coded somehow. Do we need to ignore them? */
/* Windows apparently always reports some IPv6 DNS servers that
prefixed with fec0:0:0:ffff. These ususally do not point to
working DNS servers, so we ignore them. */
if (strncmp(ret, "fec0:0:0:ffff:", 14) != 0) {
/* Append a comma to the end, THEN NULL. Should be OK because we
already tested the size at the top of the if statement. */
ret[ stringlen ] = ',';
ret[ stringlen + 1 ] = '\0';
ret += stringlen + 1;
left -= ret - ret_buf;
++count;
}
}
}
}
Expand Down
4 changes: 4 additions & 0 deletions deps/uv/src/unix/linux.c
Expand Up @@ -144,6 +144,9 @@ static void uv__inotify_read(EV_P_ ev_io* w, int revents) {
filename = e->len ? e->name : basename_r(handle->filename);

handle->cb(handle, filename, events, 0);

if (handle->fd == -1)
break;
}
}
while (handle->fd != -1); /* handle might've been closed by callback */
Expand Down Expand Up @@ -198,4 +201,5 @@ void uv__fs_event_destroy(uv_fs_event_t* handle) {
uv__close(handle->fd);
handle->fd = -1;
free(handle->filename);
handle->filename = NULL;
}
2 changes: 1 addition & 1 deletion deps/uv/src/unix/stream.c
Expand Up @@ -209,8 +209,8 @@ int uv_accept(uv_stream_t* server, uv_stream_t* client) {
if (uv__stream_open(streamClient, streamServer->accepted_fd,
UV_READABLE | UV_WRITABLE)) {
/* TODO handle error */
streamServer->accepted_fd = -1;
uv__close(streamServer->accepted_fd);
streamServer->accepted_fd = -1;
goto out;
}

Expand Down
31 changes: 29 additions & 2 deletions deps/uv/src/win/internal.h
Expand Up @@ -65,6 +65,7 @@ void uv_process_timers(uv_loop_t* loop);
#define UV_HANDLE_ZERO_READ 0x40000
#define UV_HANDLE_TTY_RAW 0x80000
#define UV_HANDLE_EMULATE_IOCP 0x100000
#define UV_HANDLE_NON_OVERLAPPED_PIPE 0x200000

void uv_want_endgame(uv_loop_t* loop, uv_handle_t* handle);
void uv_process_endgames(uv_loop_t* loop);
Expand Down Expand Up @@ -307,14 +308,40 @@ uv_err_code uv_translate_sys_error(int sys_errno);


/*
* Initialization for the windows and winsock api
* Winapi and ntapi utility functions
*/
void uv_winapi_init();


/*
* Winsock utility functions
*/
void uv_winsock_init();

int uv_ntstatus_to_winsock_error(NTSTATUS status);

BOOL uv_get_acceptex_function(SOCKET socket, LPFN_ACCEPTEX* target);
BOOL uv_get_connectex_function(SOCKET socket, LPFN_CONNECTEX* target);

int WSAAPI uv_wsarecv_workaround(SOCKET socket, WSABUF* buffers,
DWORD buffer_count, DWORD* bytes, DWORD* flags, WSAOVERLAPPED *overlapped,
LPWSAOVERLAPPED_COMPLETION_ROUTINE completion_routine);
int WSAAPI uv_wsarecvfrom_workaround(SOCKET socket, WSABUF* buffers,
DWORD buffer_count, DWORD* bytes, DWORD* flags, struct sockaddr* addr,
int* addr_len, WSAOVERLAPPED *overlapped,
LPWSAOVERLAPPED_COMPLETION_ROUTINE completion_routine);

/* Threads and synchronization */
/* Whether ipv6 is supported */
extern int uv_allow_ipv6;

/* Ip address used to bind to any port at any interface */
extern struct sockaddr_in uv_addr_ip4_any_;
extern struct sockaddr_in6 uv_addr_ip6_any_;


/*
* Threads and synchronization
*/
typedef struct uv_once_s {
unsigned char ran;
/* The actual event handle must be aligned to sizeof(HANDLE), so in */
Expand Down

0 comments on commit 145aa63

Please sign in to comment.