Commit Graph

1452 Commits

Author SHA1 Message Date
Ben Noordhuis
7a64ec49ff test: clean up test-tcp-writealot.c
Avoid unnecessary heap allocations, makes it easier to reason about correctness.
2012-05-23 01:50:10 +02:00
Igor Zinkovsky
2df831723f windows: set flags for uv_fs_symlink 2012-05-22 16:32:17 -07:00
Igor Zinkovsky
253d718572 report correct error 2012-05-22 15:58:01 -07:00
Bert Belder
0ef7844b87 Disable test-callback-order
It's not correct.
2012-05-22 17:13:04 +02:00
Bert Belder
d1665792ca Get rid of UV_HANDLE_TYPE_PRIVATE 2012-05-22 16:11:24 +02:00
Bert Belder
58ba2d86e1 Move shared c-ares glue code from uv-common to cares.c 2012-05-22 16:11:23 +02:00
Bert Belder
c06edd4c88 windows, unix: share c-ares glue code 2012-05-22 16:11:22 +02:00
Bert Belder
25316a3f92 Make the gethostbyname benchmark more precise 2012-05-22 16:11:21 +02:00
Ben Noordhuis
a478847f74 test: add callback order test
Ensure that idle callbacks run before other callbacks.
2012-05-22 16:04:11 +02:00
Ben Noordhuis
80b554129b unix: reactive new idle watcher implementation
The new idle watcher was temporarily disabled in 073a48d due to some semantic
incompatibilities with the previous implementation. This commit resolves those
issues and reactivates the new implementation.

One outstanding bug is that idle watchers can run in a different order
(relative to other handle types) than the old implementation, e.g. (timer, idle)
instead of the expected (idle, timer). This will be fixed in an upcoming commit.
2012-05-22 15:13:52 +02:00
Ben Noordhuis
6190caba05 unix: remove outdated comment 2012-05-22 15:08:29 +02:00
Igor Zinkovsky
ea8fa31fc0 fix fs_symlink_dir test 2012-05-22 00:23:26 -07:00
Bert Belder
ad279df7c0 Unix: remove superfluous variable from uv_poll_start 2012-05-22 01:03:47 +02:00
Ben Noordhuis
6fd9bfb7b0 unix: fix event loop block, prepare/check invoke
Don't block in epoll_wait() / kevent() / etc. syscall unless there are active
handles. If there are only active requests, do a non-blocking poll.

Likewise, don't run the prepare and check watchers unless there are active
handles *or* requests.
2012-05-21 17:41:52 +02:00
Frank Denis
d27a62deff unix: fix build on dragonfly bsd
Unbreak compilation on Dragonfly BSD, that uses kqueue, too.
2012-05-21 15:44:20 +02:00
Ben Noordhuis
e82d46452e unix: fix close-before-connect bug
Closing the TCP socket before the SYN/ACK handshake completed hung the event
loop, the connect req didn't get unregistered.
2012-05-18 01:19:57 +02:00
Ben Noordhuis
e10a87adb9 unix: streamline shutdown req cleanup logic 2012-05-18 01:19:57 +02:00
Ben Noordhuis
7447048981 test: enable tcp_connect_error_fault test 2012-05-18 01:19:57 +02:00
Ben Noordhuis
538a562cdb test: add tcp connect timeout test 2012-05-18 01:19:56 +02:00
Ben Noordhuis
073a48d6bf unix: back out new idle watcher for now
Its semantics don't quite match what node.js expects. This breaks the
stdio_over_pipes and shutdown_close_pipe tests but that can't be helped.
2012-05-18 01:19:56 +02:00
Igor Zinkovsky
60af28abab windows: support junctions with uv_fs_synlink
based on @piscisaureus implementation
2012-05-17 09:53:26 -07:00
Ben Noordhuis
9efa8b3571 unix, windows: rework reference counting scheme
This commit changes how the event loop determines if it needs to stay alive.

Previously, an internal counter was increased whenever a handle got created
and decreased again when the handle was closed.

While conceptually simple, it turned out hard to work with: you often want
to keep the event loop alive only if the handle is actually doing something.
Stopped or inactive handles were a frequent source of hanging event loops.

That's why this commit changes the reference counting scheme to a model where
a handle only references the event loop when it's active. 'Active' means
different things for different handle types, e.g.:

 * timers: ticking
 * sockets: reading, writing or listening
 * processes: always active (for now, subject to change)
 * idle, check, prepare: only active when started

This commit also changes how the uv_ref() and uv_unref() functions work: they
now operate on the level of individual handles, not the whole event loop.

The Windows implementation was done by Bert Belder.
2012-05-17 07:07:53 +02:00
Frank Denis
07622e767d unix: change #if FIONBIO to #ifdef FIONBIO
Fixes compilation on Debian/ppc 6.0.4.
2012-05-16 16:59:42 +02:00
Ben Noordhuis
ad024040fc test: prevent accidental division by zero 2012-05-07 16:41:05 +02:00
Andrius Bentkus
985b961d4e Put POLL into the handle_map, so handle_size returns the size of it correctly. 2012-05-05 17:31:16 +02:00
Ben Noordhuis
b5f9bc861f sunos: make fs.watch scale better
Instead of using one port per watch, use one port for all the watches.
This is a cherry-pick of commit 7326962 from v0.6 into master.

Conflicts:

	include/uv-private/uv-unix.h
	src/unix/core.c
	src/unix/sunos.c
2012-05-05 00:51:32 +00:00
Bert Belder
1d24c76df7 Windows: fix MinGW
MinGW's headers are missing a definition for SIO_BASE_HANDLE
2012-05-05 00:05:36 +02:00
Bert Belder
4365896921 Windows: skip GetFileAttributes call when opening a file
It wasn't working, and everything seemed to work fine nonetheless. Removing it just saves a syscall.
2012-05-04 14:31:48 -07:00
Bert Belder
b750dec517 Windows: fix iocp emulation bugs for tcp handles
Makes ipc_tcp_connection pass on Windows XP
2012-05-04 13:54:02 -07:00
Bert Belder
ef9a9f1f78 Tests: make test-tcp-write-error pass on XP 2012-05-04 13:02:55 -07:00
Ben Noordhuis
6037684ef8 unix: zero out new loop struct
Fixes spurious segfaults in pyuv.
2012-05-04 15:02:33 +02:00
Ben Noordhuis
ce129ac6e2 windows: remove unused variables 2012-05-03 19:50:49 +02:00
Ben Noordhuis
395e256889 unix: don't use setlocale()
setlocale() is not inherently thread-safe. We'll have to live with the fact
that test/test-dlerror.c fails on systems with localized error messages.
2012-05-03 19:50:40 +02:00
Ben Noordhuis
5d19aa84f0 unix, win: rework uv_dlopen() API 2012-05-03 19:36:40 +02:00
Ben Noordhuis
93d16e6a84 unix: change uv_dl*() error code
Return UV_ENOENT instead of UV_EINVAL. UV_EINVAL was arbitrarily chosen and
turns out to be inconsistent with the Windows implementation.

Fixes #395.
2012-05-03 16:54:59 +02:00
Bert Belder
acd0afb296 Merge branch 'poll'
Closes: #316, #401
Ref: #265, #349
2012-05-03 16:14:02 +02:00
Bert Belder
b9504f7987 Rename uv_platform_socket_t to uv_os_sock_t 2012-05-03 16:05:05 +02:00
Bert Belder
444ab19be8 Benchmarks: add size of uv_poll_t to benchmark-sizes 2012-05-03 15:52:57 +02:00
Bert Belder
beaf750700 Test: add tests for uv_poll 2012-05-03 15:52:57 +02:00
Bert Belder
d60d94e0c3 Unix: implement uv_poll 2012-05-03 15:52:56 +02:00
Bert Belder
d7a71761c4 Windows: implement uv_poll 2012-05-03 15:52:52 +02:00
Bert Belder
e1154d70ce Api for polling external sockets 2012-05-03 15:51:37 +02:00
Bert Belder
e38755485e Unix: namespace stream handle flags 2012-05-03 01:47:13 +02:00
Ben Noordhuis
1ebe14e494 linux: fix build error with old kernel headers
O_CLOEXEC was introduced in linux 2.6.23, don't assume it's available.

Fixes #400.
2012-05-02 17:42:59 +02:00
Bert Belder
19aca7a7c0 Windows: add uv_msafd_poll, to support overlapped socket polling 2012-05-02 03:45:00 +02:00
Bert Belder
9f0dc2601e Windows: fetch pointer for CancelIoEx on startup 2012-05-02 03:38:31 +02:00
Bert Belder
7d45cca12a Windows: we're out of handle flags - arrange them more efficiently 2012-05-02 03:38:30 +02:00
Bert Belder
6367da25b3 Merge branch 'v0.6' 2012-05-01 16:54:27 +02:00
Ben Noordhuis
936795a2c8 windows: map ERROR_WRITE_PROTECT to UV_EROFS 2012-05-01 16:53:00 +02:00
Maciej Małecki
edb40b16ce unix: map EROFS to UV_EROFS
Conflicts:

	src/unix/error.c
2012-05-01 16:52:48 +02:00