Skip to content

Commit 145aa63

Browse files
committed
uv: upgrade to 28234d7
1 parent be2320d commit 145aa63

File tree

21 files changed

+1030
-130
lines changed

21 files changed

+1030
-130
lines changed

deps/uv/AUTHORS

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,3 +29,5 @@ Fedor Indutny <[email protected]>
2929
Saúl Ibarra Corretgé <[email protected]>
3030
Felix Geisendörfer <[email protected]>
3131
Yuki OKUMURA <[email protected]>
32+
Roman Shtylman <[email protected]>
33+
Frank DENIS <[email protected]>

deps/uv/include/uv-private/uv-win.h

Lines changed: 38 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,27 @@
104104
DWORD dwFlags);
105105
#endif
106106

107+
typedef int (WSAAPI* LPFN_WSARECV)
108+
(SOCKET socket,
109+
LPWSABUF buffers,
110+
DWORD buffer_count,
111+
LPDWORD bytes,
112+
LPDWORD flags,
113+
LPWSAOVERLAPPED overlapped,
114+
LPWSAOVERLAPPED_COMPLETION_ROUTINE
115+
completion_routine);
116+
117+
typedef int (WSAAPI* LPFN_WSARECVFROM)
118+
(SOCKET socket,
119+
LPWSABUF buffers,
120+
DWORD buffer_count,
121+
LPDWORD bytes,
122+
LPDWORD flags,
123+
struct sockaddr* addr,
124+
LPINT addr_len,
125+
LPWSAOVERLAPPED overlapped,
126+
LPWSAOVERLAPPED_COMPLETION_ROUTINE completion_routine);
127+
107128

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

171192
#define UV_WRITE_PRIVATE_FIELDS \
172-
int ipc_header;
193+
int ipc_header; \
194+
uv_buf_t write_buffer; \
195+
HANDLE event_handle; \
196+
HANDLE wait_handle;
173197

174198
#define UV_CONNECT_PRIVATE_FIELDS \
175199
/* empty */
@@ -194,7 +218,13 @@ RB_HEAD(uv_timer_tree_s, uv_timer_s);
194218
HANDLE event_handle; \
195219
HANDLE wait_handle; \
196220
struct uv_tcp_accept_s* next_pending; \
197-
} uv_tcp_accept_t;
221+
} uv_tcp_accept_t; \
222+
\
223+
typedef struct uv_read_s { \
224+
UV_REQ_FIELDS \
225+
HANDLE event_handle; \
226+
HANDLE wait_handle; \
227+
} uv_read_t;
198228

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

206236
#define UV_STREAM_PRIVATE_FIELDS \
207237
unsigned int reqs_pending; \
208-
uv_req_t read_req; \
238+
uv_read_t read_req; \
209239
union { \
210240
struct { uv_stream_connection_fields }; \
211241
struct { uv_stream_server_fields }; \
@@ -236,7 +266,9 @@ RB_HEAD(uv_timer_tree_s, uv_timer_s);
236266
struct sockaddr_storage recv_from; \
237267
int recv_from_len; \
238268
uv_udp_recv_cb recv_cb; \
239-
uv_alloc_cb alloc_cb;
269+
uv_alloc_cb alloc_cb; \
270+
LPFN_WSARECV func_wsarecv; \
271+
LPFN_WSARECVFROM func_wsarecvfrom;
240272

241273
#define uv_pipe_server_fields \
242274
uv_pipe_accept_t accept_reqs[4]; \
@@ -247,7 +279,8 @@ RB_HEAD(uv_timer_tree_s, uv_timer_s);
247279
uv_write_t ipc_header_write_req; \
248280
int ipc_pid; \
249281
uint64_t remaining_ipc_rawdata_bytes; \
250-
WSAPROTOCOL_INFOW* pending_socket_info;
282+
WSAPROTOCOL_INFOW* pending_socket_info; \
283+
uv_write_t* non_overlapped_writes_tail;
251284

252285
#define UV_PIPE_PRIVATE_FIELDS \
253286
HANDLE handle; \

deps/uv/include/uv.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -610,7 +610,7 @@ int uv_udp_send6(uv_udp_send_t* req, uv_udp_t* handle, uv_buf_t bufs[],
610610
int bufcnt, struct sockaddr_in6 addr, uv_udp_send_cb send_cb);
611611

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

1064-
/*
1064+
/*
10651065
* This flag can be used with uv_fs_symlink on Windows
10661066
* to specify whether path argument points to a directory.
10671067
*/

deps/uv/src/ares/ares_init.c

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -696,17 +696,20 @@ static int get_iphlpapi_dns_info (char *ret_buf, size_t ret_size)
696696
struct sockaddr_in6 *pIPv6Addr = ( struct sockaddr_in6 * ) pGenericAddr;
697697
ares_inet_ntop( AF_INET6, &pIPv6Addr->sin6_addr, ret, ipv6_size - 1 ); /* -1 for comma */
698698

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

708-
/* NB on Windows this also returns stuff in the fec0::/10 range,
709-
seems to be hard-coded somehow. Do we need to ignore them? */
701+
/* Windows apparently always reports some IPv6 DNS servers that
702+
prefixed with fec0:0:0:ffff. These ususally do not point to
703+
working DNS servers, so we ignore them. */
704+
if (strncmp(ret, "fec0:0:0:ffff:", 14) != 0) {
705+
/* Append a comma to the end, THEN NULL. Should be OK because we
706+
already tested the size at the top of the if statement. */
707+
ret[ stringlen ] = ',';
708+
ret[ stringlen + 1 ] = '\0';
709+
ret += stringlen + 1;
710+
left -= ret - ret_buf;
711+
++count;
712+
}
710713
}
711714
}
712715
}

deps/uv/src/unix/linux.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,9 @@ static void uv__inotify_read(EV_P_ ev_io* w, int revents) {
144144
filename = e->len ? e->name : basename_r(handle->filename);
145145

146146
handle->cb(handle, filename, events, 0);
147+
148+
if (handle->fd == -1)
149+
break;
147150
}
148151
}
149152
while (handle->fd != -1); /* handle might've been closed by callback */
@@ -198,4 +201,5 @@ void uv__fs_event_destroy(uv_fs_event_t* handle) {
198201
uv__close(handle->fd);
199202
handle->fd = -1;
200203
free(handle->filename);
204+
handle->filename = NULL;
201205
}

deps/uv/src/unix/stream.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,8 +209,8 @@ int uv_accept(uv_stream_t* server, uv_stream_t* client) {
209209
if (uv__stream_open(streamClient, streamServer->accepted_fd,
210210
UV_READABLE | UV_WRITABLE)) {
211211
/* TODO handle error */
212-
streamServer->accepted_fd = -1;
213212
uv__close(streamServer->accepted_fd);
213+
streamServer->accepted_fd = -1;
214214
goto out;
215215
}
216216

deps/uv/src/win/internal.h

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ void uv_process_timers(uv_loop_t* loop);
6565
#define UV_HANDLE_ZERO_READ 0x40000
6666
#define UV_HANDLE_TTY_RAW 0x80000
6767
#define UV_HANDLE_EMULATE_IOCP 0x100000
68+
#define UV_HANDLE_NON_OVERLAPPED_PIPE 0x200000
6869

6970
void uv_want_endgame(uv_loop_t* loop, uv_handle_t* handle);
7071
void uv_process_endgames(uv_loop_t* loop);
@@ -307,14 +308,40 @@ uv_err_code uv_translate_sys_error(int sys_errno);
307308

308309

309310
/*
310-
* Initialization for the windows and winsock api
311+
* Winapi and ntapi utility functions
311312
*/
312313
void uv_winapi_init();
314+
315+
316+
/*
317+
* Winsock utility functions
318+
*/
313319
void uv_winsock_init();
320+
314321
int uv_ntstatus_to_winsock_error(NTSTATUS status);
315322

323+
BOOL uv_get_acceptex_function(SOCKET socket, LPFN_ACCEPTEX* target);
324+
BOOL uv_get_connectex_function(SOCKET socket, LPFN_CONNECTEX* target);
325+
326+
int WSAAPI uv_wsarecv_workaround(SOCKET socket, WSABUF* buffers,
327+
DWORD buffer_count, DWORD* bytes, DWORD* flags, WSAOVERLAPPED *overlapped,
328+
LPWSAOVERLAPPED_COMPLETION_ROUTINE completion_routine);
329+
int WSAAPI uv_wsarecvfrom_workaround(SOCKET socket, WSABUF* buffers,
330+
DWORD buffer_count, DWORD* bytes, DWORD* flags, struct sockaddr* addr,
331+
int* addr_len, WSAOVERLAPPED *overlapped,
332+
LPWSAOVERLAPPED_COMPLETION_ROUTINE completion_routine);
316333

317-
/* Threads and synchronization */
334+
/* Whether ipv6 is supported */
335+
extern int uv_allow_ipv6;
336+
337+
/* Ip address used to bind to any port at any interface */
338+
extern struct sockaddr_in uv_addr_ip4_any_;
339+
extern struct sockaddr_in6 uv_addr_ip6_any_;
340+
341+
342+
/*
343+
* Threads and synchronization
344+
*/
318345
typedef struct uv_once_s {
319346
unsigned char ran;
320347
/* The actual event handle must be aligned to sizeof(HANDLE), so in */

0 commit comments

Comments
 (0)