Commit Graph

773 Commits

Author SHA1 Message Date
Fedor Indutny
8f15aae52f tcp: uv_tcp_dualstack()
Explicitly disable/enable dualstack depending on presence of flag set by
uv_tcp_dualstack() function.
2014-01-19 23:07:42 +00:00
Bert Belder
140c863ff0 Merge branch 'v0.10'
Conflicts:
	build.mk
	Makefile.am
	test/test-ipc.c
2013-12-21 02:42:48 -08:00
Bert Belder
16c4b21e4d test: make test-pipe-server-close pass on linux
When a server and a client are both part of the same event loop, and
the client connects to the server, the order in which the connect
callback and the connection callback are called is unspecified.
Apparently on linux the connection callback sometimes happens first,
which is not a bug, and should not make this test fail.
2013-12-21 02:34:44 -08:00
Bert Belder
c66340d59b test: add pipe-server-close test
Add a regression test for the pipe server close issue on Windows, which
was reported in joyent/node#6749 and fixed in 7b16a3f.
2013-12-20 19:40:02 -08:00
Bert Belder
562d7a49ac code style: strip trailing whitespace 2013-12-20 19:38:37 -08:00
Sam Roberts
ed36b85d3b unix, windows: add uv_loop_alive() function
Useful to know when the the event loop is empty, this can't be done with
uv_run() without possibly blocking, or running some events (which might
empty the event loop as a side-effect).
2013-12-19 15:35:03 -08:00
Joshua Neuheisel
b44edf313c test: allow UV_EACCES in spawn_fails
Allow UV_EACCES as a successful return value when uv_spawn fails.

When the PATH environment variable contains a directory which the
user cannot access, execvp may return EACCES instead of ENOENT.

fix #1045.
2013-12-18 14:02:51 +04:00
Fedor Indutny
17d60e3f94 stream: allow multiple buffers for uv_try_write 2013-12-13 22:59:47 +04:00
Fedor Indutny
7f65a74f8e test: remove C++ style comment 2013-12-13 22:37:14 +04:00
Fedor Indutny
b5e7798a89 stream: introduce uv_try_write(...)
`uv_try_write(stream, buf, size)` acts like `uv_write()`,
but without queueing actual write until UV_POLLOUT (or IOCP completion).
This is useful for doing writes using on-stack `uv_write_t` requests.

fix #1025
2013-12-13 22:29:00 +04:00
Yorkie
4ed6496b9c unix, windows: detect errors in uv_ip4/6_addr 2013-12-13 09:27:28 +01:00
Saúl Ibarra Corretgé
15af49a7a0 unix, windows: always update loop time
Fixes #846
2013-12-10 09:13:34 +01:00
Ben Noordhuis
a43537eead test: back-port EMFILE test from master branch
Back-port the test from commit 27795cf from the master branch ("unix:
fix accept() EMFILE error handling").
2013-11-25 12:58:39 +01:00
Ben Noordhuis
27795cfc0f unix: fix accept() EMFILE error handling
Fix a bug that was introduced in commit 3ee4d3f ("unix, windows:
return error codes directly") and add a regression test for good
measure.

Hat tip to Fedor for pointing out the issue.

Fixes #1007.
2013-11-25 01:54:47 +01:00
Ben Noordhuis
0c05532e13 test: don't connect to 0.0.0.0
OpenBSD won't let you do that, the connect() system call fails with
an EINVAL error.  Connect to 127.0.0.1 instead.
2013-11-16 21:58:03 +01:00
Fedor Indutny
86b5c1ef1c test: test fsevents error reporting
Create a lot of `FSEventStream`s to make `FSEventStreamStart()` fail.
Fetch the error code and verify that it is correct.
2013-11-13 18:18:56 +04:00
Ben Noordhuis
17711b9053 Merge remote-tracking branch 'origin/v0.10'
Conflicts:
	AUTHORS
	ChangeLog
	src/unix/darwin.c
	src/version.c
2013-11-13 13:52:53 +01:00
Fedor Indutny
6149b66ccb Merge branch 'v0.10'
Conflicts:
	build.mk
	src/unix/core.c
	src/unix/darwin.c
2013-11-12 15:30:54 +04:00
Fedor Indutny
bbccafbe70 unix: fix reopened fd bug
When fd is closed and new one (with the same number) is opened inside
kqueue/epoll/port loop's callback - stale events might invoke callbacks
on wrong watchers.

Check if watcher was changed after invocation and invalidate all events
with the same fd.

fix #826
2013-11-12 15:02:59 +04:00
Fedor Indutny
0f5c28b684 fsevents: use FlagNoDefer for FSEventStreamCreate
Otherwise `FSEventStreamCreate()` will coalesce events, even if they're
happening in the interval, bigger than supplied `latency`. In other
words, if this flag is not set events will happen in separate callback
only if there was a delay bigger than `latency` between two consecutive
events.
2013-11-10 13:05:27 +04:00
Ben Noordhuis
24bfef2ef4 linux: handle EPOLLHUP without EPOLLIN/EPOLLOUT
Work around an epoll quirk where it sometimes reports just the EPOLLERR
or EPOLLHUP event.  In order to force the event loop to move forward,
we merge in the read/write events that the watcher is interested in;
uv__read() and uv__write() will then deal with the error or hangup in
the usual fashion.

Fixes #982.
2013-11-08 05:16:55 +01:00
Ben Noordhuis
2bb3326c48 Merge remote-tracking branch 'origin/v0.10'
Drops commit 3780e12 ("fsevents: support japaneese characters in path")
for being quite inapplicable to the master branch.  Will be reworked
and applied in a follow-up commit.

Conflicts:
	README.md
	build.mk
	src/unix/fsevents.c
	src/unix/udp.c
2013-11-08 03:44:31 +01:00
Alex Crichton
f764bff699 unix: return exec errors from uv_spawn, not async
If spawning a process fails due to an exec() failure (but it succeeded
in forking), then this should be considered a spawn failure instead of
an asynchronous termination of the process. This allows to check for
common exec() failure conditions such as a bad path quickly instead of
having to rely on keeping track of the async callback.

Additionally, the meaning of the two fields returned in the callback are
now exactly what they advertise to be. The process exit argument is not
one of two values depending on what happened to the child.

Fixes #978.
2013-11-07 22:10:38 +01:00
Ben Noordhuis
7f44933c43 include: remove uv_strlcat() and uv_strlcpy()
It was pointed out that they don't quite work like their BSD namesakes
and they arguably shouldn't have been part of the API anyway.

Fixes #983.
2013-11-03 03:50:23 +01:00
Fedor Indutny
f9960184fd test: add regression test for 29fdb3471 2013-10-31 01:16:02 +04:00
Sean Farrell
ee434b3069 test: remove replacement snprintf for mingw
Mingw has a proper definition of snprintf.
2013-10-25 13:01:31 +02:00
Ben Noordhuis
147ab0c582 test: clean up signal_multiple_loops
The test uses some questionable binary math.  Rewrite it in a more
explicit fashion.
2013-10-20 13:57:16 +02:00
Saúl Ibarra Corretgé
9d44d786ad unix, windows: add uv_fs_event_start/stop functions
Make uv_fs_event behave like other handles, that is, it's inactive after
init, and it's active between start and stop.
2013-10-12 20:37:05 +02:00
Luca Bruno
a1e159f04e test: relax timing assumption of timer_again
timer_again test makes an implicit assumption on the triggering
timing of a repeating timer. However, this assumption may be not
true on slower or virtualized architecture due to delay accumulation,
which may fail the test as show in [0].
This commit makes explicit checks conforming to the asserted behavior.

[0] http://ur1.ca/fr5c4

Signed-off-by: Luca Bruno <lucab@debian.org>
2013-10-08 16:26:04 +02:00
Luca Bruno
bddf357baf test: relax timing assumption of loop_stop
The loop_stop test makes an implicit assumption about the triggering
timing of a repeating trigger, which may not hold true on slower or
virtualized machines, thus failing the test as shown at [0] and
discussed at [1].
This commit relaxes the assumption, without mandating the exact number
of runs.

[0] http://ur1.ca/fr5bw
[1] https://groups.google.com/d/msg/libuv/5-fNIC7hIAo/yqznDmwHDAIJ

Signed-off-by: Luca Bruno <lucab@debian.org>
2013-10-08 16:26:04 +02:00
Luca Bruno
6462eaf4dc test: relax TTY availability assumptions
test-tty.c currently assumes that a TTY is available to the test runner,
and fails hard if not. This may not be true on some autobuilding
environment, making the build fail as shown in [0].
Instead, let's properly skip the test in such cases.

[0] http://ur1.ca/fr5bd

Signed-off-by: Luca Bruno <lucab@debian.org>
2013-10-08 16:26:04 +02:00
Fedor Indutny
429bb804ed fsevents: fix clever rescheduling
There're could be a situation, where one fsevents handle gets created
and another one is destroyed simultaneously. In such cases
`fsevent_need_reschedule` will be set to 1 twice and reset only once,
leaving handle destructor hanging in uv_sem_wait().
2013-10-05 22:18:06 +04:00
Ben Noordhuis
359d667893 unix: sanity-check fds before closing
Ensure that close() system calls don't close stdio file descriptors
because that is almost never the intention.

This is also a partial workaround for a kernel bug that seems to affect
all Linux kernels when stdin is a pipe that gets closed: fd 0 keeps
signalling EPOLLHUP but a subsequent call to epoll_ctl(EPOLL_CTL_DEL)
fails with EBADF.  See joyent/node#6271 for details and a test case.
2013-10-01 03:55:54 +02:00
Ben Noordhuis
b460142451 bench: measure total/init/dispatch/cleanup times
* Add finer-grained measurements to the million_timers benchmark.
  Before this commit it only measured the total running time.

* Bump the number of inserted timers from 1M to 10M.  With one million
  timers, it finishes too quickly to get useful profiling data out of
  it with perf or oprofile.  The name of the benchmark is now a lie but
  such is life.
2013-09-13 00:17:52 +02:00
Ben Noordhuis
d7115f0677 unix, windows: make uv_is_*() always return 0 or 1
Ensure that the following API functions always return either 0 or 1:

  * uv_is_active()
  * uv_is_closing()
  * uv_is_readable()
  * uv_is_writable()
2013-09-12 13:30:06 +02:00
Ben Noordhuis
f5baf210df test: wrap long lines at 80 columns 2013-09-11 17:29:43 +02:00
Saúl Ibarra Corretgé
2b9c374c1c windows: run close callbacks after polling for i/o
Makes the uv-win behavior compatible with uv-unix.

Fixes #796.
2013-09-06 06:28:42 +02:00
Ben Noordhuis
08c6ddeefb include: merge uv_udp_send and uv_udp_send6
Merge uv_udp_send6() into uv_udp_send().  uv_udp_send() now takes a
const struct sockaddr*.
2013-09-04 03:17:29 +02:00
Ben Noordhuis
bcee403ed2 include: merge uv_udp_bind and uv_udp_bind6
Merge uv_udp_bind6() into uv_udp_bind().  uv_udp_bind() now takes a
const struct sockaddr*.
2013-09-04 03:17:04 +02:00
Ben Noordhuis
5c675c4a4e include: merge uv_tcp_connect and uv_tcp_connect6
Merge uv_tcp_connect6() into uv_tcp_connect().  uv_tcp_connect() now
takes a const struct sockaddr*.
2013-09-04 03:16:36 +02:00
Ben Noordhuis
5fceccc535 include: merge uv_tcp_bind and uv_tcp_bind6
Merge uv_tcp_bind6() into uv_tcp_bind().  uv_tcp_bind() now takes a
const struct sockaddr*.
2013-09-04 03:15:30 +02:00
Ben Noordhuis
8c6ea10502 include: uv_spawn takes const uv_process_options_t*
Passing or returning structs as values makes life hard for people that
work with libuv through a foreign function interface. Switch to a
pointer-based approach.

Fixes #684.
2013-09-01 08:25:00 +02:00
Ben Noordhuis
263da51967 include: uv_udp_send{6} now takes sockaddr_in*
Passing or returning structs as values makes life hard for people that
work with libuv through a foreign function interface. Switch to a
pointer-based approach.

Fixes #684.
2013-09-01 08:02:20 +02:00
Ben Noordhuis
525dbb5e31 include: uv_udp_bind{6} now takes sockaddr_in*
Passing or returning structs as values makes life hard for people that
work with libuv through a foreign function interface. Switch to a
pointer-based approach.

Fixes #684.
2013-09-01 08:02:18 +02:00
Ben Noordhuis
0f7b2963ad include: uv_udp_recv_cb now takes const uv_buf_t*
Passing or returning structs as values makes life hard for people that
work with libuv through a foreign function interface. Switch to a
pointer-based approach.

Fixes #684.
2013-09-01 08:02:17 +02:00
Ben Noordhuis
255671da74 include: uv_tcp_connect{6} now takes sockaddr_in*
Passing or returning structs as values makes life hard for people that
work with libuv through a foreign function interface. Switch to a
pointer-based approach.

Fixes #684.
2013-09-01 08:02:15 +02:00
Ben Noordhuis
daa229ace3 include: uv_tcp_bind{6} now takes sockaddr_in*
Passing or returning structs as values makes life hard for people that
work with libuv through a foreign function interface. Switch to a
pointer-based approach.

Fixes #684.
2013-09-01 08:02:13 +02:00
Ben Noordhuis
8184076879 include: uv_ip[46]_addr now takes sockaddr_in*
Passing or returning structs as values makes life hard for people that
work with libuv through a foreign function interface. Switch to a
pointer-based approach.

Fixes #684.
2013-09-01 08:02:07 +02:00
Ben Noordhuis
b7d027c3a8 include: uv_read{2}_cb now takes const uv_buf_t*
Passing or returning structs as values makes life hard for people that
work with libuv through a foreign function interface. Switch to a
pointer-based approach.

Fixes #684.
2013-09-01 08:01:34 +02:00
Ben Noordhuis
3fb6612233 include: uv_alloc_cb now takes uv_buf_t*
Passing or returning structs as values makes life hard for people that
work with libuv through a foreign function interface. Switch to a
pointer-based approach.

Fixes #684.
2013-09-01 07:57:31 +02:00