Commit Graph

2934 Commits

Author SHA1 Message Date
Saúl Ibarra Corretgé
fabafd6236 windows: make sure sockets and handles are reset on close
Set the socket to INVALID_SOCKET foir TCP and UDP handles and
the handle to INVALID_HANDLE_VALUE on TTY handles after closing them.
2014-08-27 10:53:40 +02:00
Saúl Ibarra Corretgé
4ca9a36389 unix, windows: add uv_fileno
Returns the platform specific file descriptor for handles that are
backed by one. The datatype is abstracted as uv_os_fd_t, which maps to
int on Unices and HANDLE on Windows.

Users can use this function to set specific socket options, for example,
in a non portable way.

This function is essentially a shotgun, you better be careful with
whatever you do with it, don't blame me if you used it to get the fd of
a stream, close it yourself and expect things to Just Work.
2014-08-27 10:53:40 +02:00
Saúl Ibarra Corretgé
bd0692e65a build: use same CFLAGS in autotools build as in gyp
Closes #1362
2014-08-24 15:19:26 +02:00
Saúl Ibarra Corretgé
394d2188ba build: remove unneeded define in uv.gyp
It's a leftover from the days libuv bundled c-ares.
2014-08-24 15:10:12 +02:00
Saúl Ibarra Corretgé
2f83613023 test: fix watcher_cross_stop on Windows
All send callbacks are not necessarily called on the same loop iteration
as the data is received.
2014-08-21 23:34:51 +02:00
Saúl Ibarra Corretgé
a87619ce63 unix, windows: move includes for EAI constants 2014-08-21 21:31:02 +02:00
Saúl Ibarra Corretgé
76cd67686c unix: fix exposing EAI_* glibc-isms 2014-08-21 16:48:45 +02:00
Andrius Bentkus
d5e6f4372f unix: fix tcp write after bad connect freezing
If the connect wouldn't go off (no such tcp remote or any other failure),
the subsequent writes made would not be called. Now we call the writes
in the queue with ECANCELED if the connect fails.

Fix #1432
2014-08-21 16:23:43 +02:00
Timothy J Fontaine
a4f03504ce Now working on v0.11.30 2014-08-19 11:03:54 -04:00
Timothy J Fontaine
35451fed83 2014.08.20, Version 0.11.29 (Unstable)
Changes since version 0.11.28:

* windows: make uv_read_stop immediately stop reading (Jameson Nash)

* windows: fix uv__getaddrinfo_translate_error (Alexis Campailla)

* netbsd: fix build (Saúl Ibarra Corretgé)

* unix, windows: add uv_recv_buffer_size and uv_send_buffer_size
  (Andrius Bentkus)

* windows: add support for UNC paths on uv_spawn (Paul Goldsmith)

* windows: replace use of inet_addr with uv_inet_pton (Saúl Ibarra
  Corretgé)

* unix: replace some asserts with returning errors (Andrius Bentkus)

* windows: use OpenBSD implementation for uv_fs_mkdtemp (Pavel Platto)

* windows: fix GetNameInfoW error handling (Alexis Campailla)

* fs: introduce uv_readdir_next() and report types (Fedor Indutny)

* fs: extend reported types in uv_fs_readdir_next (Saúl Ibarra Corretgé)

* unix: read on stream even when UV__POLLHUP set. (Julien Gilli)
2014-08-19 11:03:51 -04:00
Julien Gilli
1552184238 unix: read on stream even when UV__POLLHUP set.
This fixes a SmartOS specific issue that happens when reading from
a stream that is the reading end of a pipe that has been closed by
the parent process.

In this case, a UV__POLLHUP event would be set on the stream and would
prevent the event loop from closing it. As a result, the event loop
would think there are stil handles open, and leave the process
hanging.

Fixes #1419.
2014-08-18 09:06:27 -07:00
Saúl Ibarra Corretgé
fdbc8567af unix: fix colliding flag value
Fixes #1425
2014-08-18 10:14:21 +02:00
Saúl Ibarra Corretgé
df8ab507a0 fs: extend reported types in uv_fs_readdir_next
Support all possible types on Unix, and files, directories and links on
Windows. Some systems (hello SunOS!) don't have the d_type field on struct
dirent, so mark them as UV_DIRENT_UNKNOWN.
2014-08-15 16:44:44 +02:00
Fedor Indutny
ab2c4425a5 fs: introduce uv_readdir_next() and report types
Introduce:

    int uv_fs_readdir_next(uv_fs_t* req, uv_dirent_t* ent);

`uv_fs_readdir()` is not returning a file names list in `req->ptr`
anymore, the proper way to gather them is to call `uv_fs_readdir_next()`
in a callback.
2014-08-14 17:19:45 +04:00
Alexis Campailla
7bdcf3dc7e windows: fix GetNameInfoW error handling
GetNameInfoW return non-zero on error, and not vice versa.
2014-08-12 17:42:34 +02:00
Pavel Platto
a669f21bf8 windows: use OpenBSD implementation for uv_fs_mkdtemp 2014-08-12 10:04:09 +02:00
Andrius Bentkus
875814adc5 unix: replace some asserts with returning errors 2014-08-11 18:42:48 +02:00
Saúl Ibarra Corretgé
b53aeb491a windows: replace use of inet_addr with uv_inet_pton
Fixes a compilation warning with Visual Studio 2013.
2014-08-11 09:52:48 +02:00
Leonard Hecker
4c90cc8e14 unix: fix typedef of uv_buf_t
Typedefs of unnamed structs cannot be forward declared.
Giving the uv_buf_t struct a name makes forward declarations possible.
2014-08-10 17:30:13 +02:00
huxingyi
ca4741b4a5 windows: fix build on MinGW 2014-08-10 12:09:04 +02:00
Saúl Ibarra Corretgé
09cb5b534e test: fix spawn_reads_child_path when using autoconf
Don't hardcode the name of the executable, take it from the exepath.

Fixes #1407
2014-08-10 11:25:28 +02:00
Saúl Ibarra Corretgé
84ed98e88e test: skip UDP dualstack test on BSDs
As of right now Linux comes with bindv6only=0 by default but BSDs use
bindv6only=1. It can be changed systemwide with sysctl, but it's not
nice to depend on the environment for running tests, so disable it just
on BSDs.
2014-08-10 11:04:42 +02:00
Saúl Ibarra Corretgé
94c7a13f0a test: fix udp_multicast_interface6 on FreeBSD 2014-08-10 10:39:58 +02:00
Paul Goldsmith
ac879ed8f8 windows: add support for UNC paths on uv_spawn 2014-08-10 10:14:42 +02:00
Andrius Bentkus
0ecee213ea unix, windows: add uv_recv_buffer_size and uv_send_buffer_size 2014-08-09 11:36:35 +02:00
Saúl Ibarra Corretgé
4dc0d81ccb netbsd: fix build
Thanks @ezra1!

Closes #1391
2014-08-09 11:22:41 +02:00
Alexis Campailla
c87c44fff3 windows: fix uv__getaddrinfo_translate_error
Use Windows socket error codes, as recommended by MSDN, like we already
do with GetNameInfoW.
2014-08-09 11:18:26 +02:00
Jameson Nash
837c62c71b windows: make uv_read_stop immediately stop reading
This implements locking around the blocking call to ReadFile to get
around a Windows kernel bug where a blocking ReadFile operation on a
stream can deadlock the thread. This allows uv_read_stop to immediately
cancel a pending IO operation, and allows uv_pipe_getsockname to
"pause" any pending read (from libuv) while it retrieves the
sockname information.

If unsupported by the OS (pre-Vista), this reverts to the old
(e.g. deadlock-prone) behavior

Closes #1313
2014-08-09 11:10:57 +02:00
Saúl Ibarra Corretgé
02e1ebd40b include: remove unneeded EADDRINFO errno
EADDRINFO is not a readl errno, it was used to signal any error that
getaddrinfo would return, but we return actual errors now.
2014-08-07 21:24:55 +02:00
Saúl Ibarra Corretgé
a9a4872c29 Now working on v0.11.29 2014-08-07 12:21:41 +02:00
Saúl Ibarra Corretgé
fc9e2a0bc4 2014.08.08, Version 0.11.28 (Unstable)
Changes since version 0.11.27:

* unix, windows: const-ify handle in uv_udp_getsockname (Rasmus
  Pedersen)

* windows: use UV_ECANCELED for aborted TCP writes (Saúl Ibarra
  Corretgé)

* windows: add more required environment variables (Jameson Nash)

* windows: sort environment variables before calling CreateProcess
  (Jameson Nash)

* unix, windows: move uv_loop_close out of assert (John Firebaugh)

* windows: fix buffer overflow on uv__getnameinfo_work() (lilohuang)

* windows: add uv_backend_timeout (Jameson Nash)

* test: disable tcp_close_accept on Windows (Saúl Ibarra Corretgé)

* windows: read the PATH env var of the child (Alex Crichton)

* include: avoid using C++ 'template' reserved word (Iñaki Baz Castillo)

* include: fix version number (Saúl Ibarra Corretgé)
2014-08-07 12:18:10 +02:00
Saúl Ibarra Corretgé
6bcb799a0d include: fix version number 2014-08-07 12:17:06 +02:00
Iñaki Baz Castillo
a1ff22cb7e include: avoid using C++ 'template' reserved word
Closes #1394
2014-08-06 12:52:46 +02:00
Alex Crichton
c7e4b31444 windows: read the PATH env var of the child
The unix and windows process implementations diverge in their behavior
when dealing with subprocesses that are spawned with a relative path.
With unix the *child's* PATH environment variable is read, whereas
with windows the *parent's* environment variable is read.

This commit brings the two implementation in line with respect to
their behavior of reading PATH by having both read the *child's* PATH
environment variable. This involves looking into the user-provided
environment on windows and extracting the PATH variable specifically
so it can be inspected later on.
2014-08-06 02:12:44 +02:00
Saúl Ibarra Corretgé
d802486232 test: disable tcp_close_accept on Windows
It always was a Unix only test
2014-08-05 00:14:26 +02:00
Jameson Nash
2e9d86e105 windows: add uv_backend_timeout 2014-08-04 23:18:38 +02:00
lilohuang
89fc7d80c4 windows: fix buffer overflow on uv__getnameinfo_work()
According to
http://msdn.microsoft.com/en-us/library/windows/desktop/ms738531.aspx,
"NodeBufferSize" and "ServiceBufferSize" parameters of GetNameInfoW()
function are expected to represent the number of WCHAR, not the buffer size
of memory layout.
2014-08-04 09:18:51 +02:00
John Firebaugh
2cd91f9768 unix, windows: move uv_loop_close out of assert
Closes #1387
2014-08-02 09:41:09 +02:00
Jameson Nash
8db42383ad windows: sort environment variables before calling CreateProcess 2014-08-01 09:26:21 +02:00
Jameson Nash
2ce14cfab4 windows: add more required environment variables
Adds more of the undocumented-but-required environment variables for uv_spawn
2014-08-01 09:26:21 +02:00
Saúl Ibarra Corretgé
431b535a51 windows: use UV_ECANCELED for aborted TCP writes
For consistency with Unix
2014-08-01 00:23:51 +02:00
Rasmus Christian Pedersen
e72d48ddab unix, windows: const-ify handle in uv_udp_getsockname 2014-07-31 22:27:36 +02:00
Timothy J Fontaine
ff6a718dfc Now working on v0.11.28 2014-07-31 10:11:03 -07:00
Timothy J Fontaine
ffe24f9550 2014.07.32, Version 0.11.27 (Unstable)
Changes since version 0.11.26:

* unix, windows: use the same threadpool implementation (Saúl Ibarra
  Corretgé)

* unix: use struct sockaddr_storage for target UDP addr (Saúl Ibarra
  Corretgé)

* doc: add documentation to uv_udp_start_recv (Andrius Bentkus)

* common: use common uv__count_bufs code (Andrius Bentkus)

* unix, win: add send_queue_size and send_queue_count to uv_udp_t
  (Andrius Bentkus)

* unix, win: add uv_udp_try_send (Andrius Bentkus)

* unix: return UV_EAGAIN if uv_try_write cannot write any data (Saúl
  Ibarra Corretgé)

* windows: fix compatibility with cygwin pipes (Jameson Nash)

* windows: count queued bytes even if request completed immediately
  (Saúl Ibarra Corretgé)

* windows: disable CRT debug handler on MinGW32 (Saúl Ibarra Corretgé)

* windows: map ERROR_INVALID_DRIVE to UV_ENOENT (Saúl Ibarra Corretgé)

* unix: try to write immediately in uv_udp_send (Saúl Ibarra Corretgé)

* unix: remove incorrect assert (Saúl Ibarra Corretgé)

* openbsd: avoid requiring privileges for uv_resident_set_memory (Aaron
  Bieber)

* unix: guarantee write queue cb execution order in streams (Andrius
  Bentkus)

* img: add logo files (Saúl Ibarra Corretgé)

* aix: improve AIX compatibility (Andrew Low)

* windows: return bind error immediately when implicitly binding (Saúl
  Ibarra Corretgé)

* windows: don't use atexit for cleaning up the threadpool (Saúl Ibarra
  Corretgé)

* windows: destroy work queue elements when colsing a loop (Saúl Ibarra
  Corretgé)

* unix, windows: add uv_fs_mkdtemp (Pavel Platto)

* build: handle platforms without multiprocessing.synchronize (Saúl
  Ibarra Corretgé)

* windows: change GENERIC_ALL to GENERIC_WRITE in fs__create_junction
  (Tony Kelman)

* windows: relay TCP bind errors via ipc (Alexis Campailla)
2014-07-31 10:11:01 -07:00
Alexis Campailla
6d3a051eb4 windows: relay TCP bind errors via ipc
This is the libuv side of the fix for Node's cluster module on Windows.
https://github.com/joyent/node/issues/7691

Windows and Unix return certain socket errors (i.e. EADDRINUSE) at
different times: bind on Windows, and listen on Unix.
In an effort to hide this difference, libuv on Windows stores such
errors in the bind_error field of uv_tcp_t, to defer raising it at
listen time.
This worked fine except for the case in which a socket is shared in
a Node cluster and a bind error occurs.

A previous attempt to fix this (
d1e6be1460
3da36fe00e
) was flawed becaused in an attempt to relay the error at the JS level
it caused the master to start accepting connections.

With this new approach, libuv itself is relaying the bind errors,
providing for a uniform behavior of uv_tcp_listen.
2014-07-31 17:24:40 +02:00
Tony Kelman
3d73d55627 windows: change GENERIC_ALL to GENERIC_WRITE in fs__create_junction
Fixes #1385

See ReactOS's mklink implementation and
http://stackoverflow.com/a/10508724
2014-07-31 14:39:26 +02:00
Saúl Ibarra Corretgé
c11a598d7c build: handle platforms without multiprocessing.synchronize 2014-07-31 10:12:58 +02:00
Pavel Platto
e99b89f2ad unix, windows: add uv_fs_mkdtemp 2014-07-31 09:43:55 +02:00
Saúl Ibarra Corretgé
beb54fe72d windows: destroy work queue elements when colsing a loop
Destroy the async handle used to notify about work being done, and the
mutex used to protect each loop's work queue.

Closes #1375
2014-07-28 09:40:23 +02:00
Saúl Ibarra Corretgé
c8abb29f68 windows: don't use atexit for cleaning up the threadpool
If libuv is loaded as a DLL and is later unloaded deadlocks can happen
when running atexit handlers, so we can't use synchronization
priomitives or join threads there.

For reference see https://github.com/saghul/pyuv/issues/171
2014-07-28 09:38:57 +02:00