Commit Graph

142 Commits

Author SHA1 Message Date
Ben Noordhuis
3b69c0f56d unix: split up uv-unix.h 2012-08-17 16:42:31 +02:00
Bert Belder
7fb43d3c5b windows: move uv_atomic_exchange_set to atomicops-inl.h 2012-08-14 01:04:43 +02:00
Bert Belder
762c85c3ef windows: un-break the build 2012-08-13 22:31:45 +02:00
Ben Noordhuis
837edf4c0f unix, windows: remove handle init counters
Remove the handle init counters, no one uses them.
2012-08-10 02:00:11 +02:00
Ben Noordhuis
ee50db6e36 unix, windows: preliminary signal handler support
* a no-op on Windows for now
* only supports the main loop on UNIX (again, for now)
2012-08-10 02:00:07 +02:00
Bert Belder
41b1265af8 Rip out c-ares 2012-08-07 01:04:26 +02:00
Bert Belder
a069956996 Remove c-ares integrations 2012-08-07 01:03:52 +02:00
Bert Belder
35c4858231 Remove c-ares tests and benchmarks 2012-08-07 01:03:51 +02:00
Bert Belder
32f93e14cb Add libuv-ified versions of inet_pton and inet_ntop 2012-08-07 01:03:47 +02:00
Ben Noordhuis
be1032431d Merge branch 'v0.8' 2012-07-29 03:13:21 +02:00
Ben Noordhuis
69a6afea63 unix: undo changes to uv_set_process_title()
It's making node.js crash when run as root. Backtrace:

  (gdb) bt
  #0  0x00007fff856e3ff9 in __findenv ()
  #1  0x00007fff856e404c in getenv ()
  #2  0x000000010004c850 in loop_init (loop=0x10045a792, flags=8) at ev.c:1707
  #3  0x000000010004cb3b in ev_backend [inlined] () at /Users/tjfontaine/Development/node/deps/uv/src/unix/ev/ev.c:2090
  #4  0x000000010004cb3b in ev_default_loop (flags=1606417108) at ev.c:2092
  #5  0x000000010004e5c6 in uv__loop_init (loop=0x10066e330, default_loop=1) at loop.c:52
  #6  0x0000000100044367 in uv_default_loop () at core.c:196
  #7  0x0000000100004625 in node::Init (argc=1606417456, argv=0x100b0f490) at node.cc:2761
  #8  0x000000010000797d in node::Start (argc=1606417600, argv=0x0) at node.cc:2888
  #9  0x0000000100000ca4 in start ()

This reverts commits:

  b49d6f7 unix: fix uv_set_process_title()
  a9f6f06 unix: fix format string vulnerability in freebsd.c
  a87abc7 unix: avoid buffer overflow in proctitle.c
  dc97d44 unix: move uv_set_process_title() to proctitle.c
2012-07-18 22:54:39 +02:00
Fedor Indutny
dc97d44c56 unix: move uv_set_process_title() to proctitle.c
Use hijacking argv array to change process' title. It seems to be working fine
on almost every platform (at least it should not break anything as it's used in
nginx in a similar way).
2012-07-13 14:57:40 +02:00
Ben Noordhuis
5031a5b85a unix: rename linux/core.c to linux/linux-core.c
This is a back-port of commit e1320757 from the master branch.

Newer versions of gyp do not support files with the same basenames (example:
core.c and linux/core.c).

The nominal reason is consistency across build systems. Apparently, msbuild
doesn't support it either.

Somewhere, someplace, baby Jesus cries sad little tears...

Fixes #464.
2012-07-03 20:51:32 +02:00
Ben Noordhuis
1d1dd9bb7d test: add 'unexpected read' tcp test
Regression test that verifies that the event loop doesn't busy loop when
the server sends a message and the client isn't reading.
2012-06-30 03:25:52 +02:00
Ben Noordhuis
15cfcfd309 c-ares: libuv-ify c-ares 2012-06-29 05:29:13 +02:00
Saúl Ibarra Corretgé
3e425ab9ba c-ares: upgrade to 1.9.0 2012-06-29 05:29:04 +02:00
Ben Noordhuis
c89df5b990 bench: add another async handle benchmark 2012-06-29 03:16:06 +02:00
Ben Noordhuis
3b209e7642 bench: add async handle benchmark 2012-06-29 02:29:50 +02:00
Ben Noordhuis
e132075738 unix: rename linux/core.c to linux/linux-core.c
Newer versions of gyp do not support files with the same basenames (example:
core.c and linux/core.c).

The nominal reason is consistency across build systems. Apparently, msbuild
doesn't support it either.

Somewhere, someplace, baby Jesus cries sad little tears...

Fixes #464.
2012-06-22 18:40:54 +02:00
Ben Noordhuis
5dc024f676 bench: add thread pool I/O benchmark 2012-06-21 22:40:17 +02:00
Ben Noordhuis
cc7c8542a5 unix, windows: add stat() based file watcher
Monitors a file path for changes. Supersedes ev_stat.
2012-05-31 20:32:24 +02:00
Bert Belder
07c6ac2b55 windows: move child stdio buffer ops to a separate file 2012-06-13 19:17:13 +02:00
Ben Noordhuis
0ae026dc84 bench: add lots-of-timers benchmark 2012-06-09 18:42:06 +02:00
Iñaki Baz Castillo
b47af98e00 test: add tcp 'close on failed connect' test
Demonstrates temporary event loop stall with uv-unix. The issue is that pending
requests aren't processed until the next event (I/O, timeout, etc.) happens.

See #446, #447 and #448.
2012-06-07 00:06:24 +02:00
Ben Noordhuis
7d2ea31618 unix: fix event loop stall
Stop libev from entering the epoll_wait/kevent/port_getn/etc. syscall when
there are no active handles left, that will block indefinitely.
2012-06-04 23:36:50 +02:00
Bert Belder
60746b03cb windows: move some stream functions to stream-inl.h 2012-06-04 18:04:47 +02:00
Ben Noordhuis
d08070435d test: rename test tcp_dont_connect_after_write
Rename test tcp_dont_connect_after_write to tcp_connect_error_after_write,
teensy tad more descriptive.
2012-06-04 17:35:56 +02:00
Ben Noordhuis
b96ed68f46 test: add TCP connect error + write test
Original test contributed by Iñaki Baz Castillo. See #443.
2012-06-04 15:58:32 +02:00
Ben Noordhuis
c76c2066c6 unix, windows: add semaphore functions 2012-06-03 04:04:05 +02:00
Bert Belder
d8b95eaffb windows: inline a couple of handle functions 2012-06-02 23:38:16 +02:00
Bert Belder
d402604118 windows: inline a couple of inline request functions 2012-06-02 23:08:22 +02:00
Bert Belder
9759c20e90 test: verify that closing an active poll handle doesn't hang 2012-06-01 18:39:47 +02:00
Ben Noordhuis
171ad8567d unix, windows: add uv_walk()
Lets the libuv user iterate over the open handles. Mostly intended as a
debugging tool or a post-hoc cleanup mechanism.
2012-05-30 02:33:39 +02:00
Ben Noordhuis
28766dcf55 test: remove test-eio-overflow.c
Unreliable, it's timing / system load sensitive.
2012-05-25 01:33:44 +02:00
Ben Noordhuis
cff2221fbf unix: split up loop.c
Move prepare/check/idle watcher code to loop-watcher.c so it can be reused for
the linux backend.
2012-05-23 23:47:06 +02:00
Ben Noordhuis
cd2a9b4d59 bench: measure ticks per second of idle event loop 2012-05-23 21:05:43 +02:00
Ben Noordhuis
7c8313bd0f unix, windows: make uv_run_once() return a bool
The return value of uv_run_once() now signals if it needs to be called again.

Fixes #427.
2012-05-23 20:49:03 +02:00
Bert Belder
c06edd4c88 windows, unix: share c-ares glue code 2012-05-22 16:11:22 +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
538a562cdb test: add tcp connect timeout test 2012-05-18 01:19:56 +02: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
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
Ben Noordhuis
68bed698fc unix: move loop init logic out of core.c 2012-04-04 05:54:39 -07:00
Ben Noordhuis
5a59e4924a unix: move idle code from core.c to idle.c 2012-04-04 05:25:34 +02:00
Ben Noordhuis
dd31265751 unix: move check code from core.c to check.c 2012-04-04 05:25:34 +02:00
Ben Noordhuis
f1a19e6d34 unix: move prepare code from core.c to prepare.c 2012-04-04 05:25:34 +02:00
Ben Noordhuis
f7359a335c unix: move async code from core.c to async.c 2012-04-04 05:25:34 +02:00
Ben Noordhuis
fd987a26fe unix: move timer code from core.c to timer.c 2012-04-04 05:25:27 +02:00