Changes since version 0.10.28:
* darwin: allocate enough space for select() hack (Fedor Indutny)
* linux: try epoll_pwait if epoll_wait is missing (Michael Hudson-Doyle)
* windows: map ERROR_INVALID_DRIVE to UV_ENOENT (Saúl Ibarra Corretgé)
It seems that epoll_wait is implemented in glibc in terms of epoll_pwait and
new architectures (like arm64) do not implement the epoll_wait syscall at all.
So if epoll_wait errors with ENOSYS, just call epoll_pwait.
This is a backport of 861de3d71d for v0.10
branch.
When multiple bufs are specified, overlapped needs to be advanced
manually between each write. Without this, each buf will be written
to the same position (if offset is specified.)
ReadFile() automatically advances, but WriteFile() does not.
uv_interface_addresses was using the linked list pointed to by
the FirstPrefix member of IP_ADAPTER_ADDRESSES in order to compute the
network prefix / network mask.
This was flawed in several ways:
- FirstPrefix can be NULL, and we would crash.
- On Windows Vista and later, the prefix list includes three IP adapter prefixes
for each IP address assigned to the adapter. We were assuming a 1:1 mapping
with the unicast address list.
- Even on Windows versions (i.e. XP) where the prefix list is supposed to have
one and only one element for each unicast address, the order of the two lists
is not guaranteed to be the same.
This fix was inspired and adapted from a commit in the Chromium project:
https://codereview.chromium.org/25167002/diff/6001/net/base/net_util_win.cc
See MSDN article for reference:
http://msdn.microsoft.com/en-us/library/windows/desktop/aa366058(v=vs.85).aspx
Excerpt from MSDN below:
In addition, the linked IP_ADAPTER_UNICAST_ADDRESS structures pointed to
by the FirstUnicastAddress member and the linked IP_ADAPTER_PREFIX
structures pointed to by the FirstPrefix member are maintained as separate
internal linked lists by the operating system. As a result, the order of
linked IP_ADAPTER_UNICAST_ADDRESS structures pointed to by the
FirstUnicastAddress member does not have any relationship with the order
of linked IP_ADAPTER_PREFIX structures pointed to by the FirstPrefix member.
On Windows Vista and later, the linked IP_ADAPTER_PREFIX structures pointed to
by the FirstPrefix member include three IP adapter prefixes for each IP address
assigned to the adapter. These include the host IP address prefix, the subnet
IP address prefix, and the subnet broadcast IP address prefix. In addition, for
each adapter there is a multicast address prefix and a broadcast address prefix.
It seems that epoll_wait is implemented in glibc in terms of epoll_pwait and
new architectures (like arm64) do not implement the epoll_wait syscall at all.
So if epoll_wait errors with ENOSYS, just call epoll_pwait.
The echo server shouldn't close the connection when there's an error on
write. Instead simply echo the error message and allow the other side to
close the connection.
Also do a partial revert of 4d905fb where after_shutdown was removed.
Fixes: 4d905fb "test: close stream immediately on error"
Signed-off-by: Trevor Norris <trev.norris@gmail.com>
Signed-off-by: Saúl Ibarra Corretgé <saghul@gmail.com>
- Remove the UV_HANDLE_ACTIVE flag. It's a duplicate from
UV__HANDLE_ACTIVE, which was used solely on timers and loop watchers.
- Avoid duplicated code when running timers by stopping the handle and
rearming it with the repeat time, thus having a single place where the
timers are added and removed to and from the RB tree, respectively.