asyncengine 0.0.1.testing1 → 0.0.2.alpha1
Sign up to get free protection for your applications and to get access to all the features.
- data/README.markdown +3 -0
- data/Rakefile +38 -0
- data/asyncengine.gemspec +8 -4
- data/ext/asyncengine/ae_call_from_other_thread.c +106 -0
- data/ext/asyncengine/ae_call_from_other_thread.h +12 -0
- data/ext/asyncengine/ae_handle_common.c +193 -48
- data/ext/asyncengine/ae_handle_common.h +40 -13
- data/ext/asyncengine/ae_ip_utils.c +246 -0
- data/ext/asyncengine/ae_ip_utils.h +25 -0
- data/ext/asyncengine/ae_next_tick.c +81 -21
- data/ext/asyncengine/ae_next_tick.h +4 -2
- data/ext/asyncengine/ae_resolver.c +156 -0
- data/ext/asyncengine/ae_resolver.h +10 -0
- data/ext/asyncengine/ae_tcp.c +908 -0
- data/ext/asyncengine/ae_tcp.h +20 -0
- data/ext/asyncengine/ae_timer.c +355 -81
- data/ext/asyncengine/ae_timer.h +11 -4
- data/ext/asyncengine/ae_udp.c +579 -13
- data/ext/asyncengine/ae_udp.h +15 -2
- data/ext/asyncengine/ae_utils.c +192 -0
- data/ext/asyncengine/ae_utils.h +16 -0
- data/ext/asyncengine/asyncengine_ruby.c +469 -26
- data/ext/asyncengine/asyncengine_ruby.h +49 -11
- data/ext/asyncengine/debug.h +68 -0
- data/ext/asyncengine/extconf.rb +26 -2
- data/ext/asyncengine/ip_parser.c +5954 -0
- data/ext/asyncengine/ip_parser.h +16 -0
- data/ext/asyncengine/libuv/AUTHORS +16 -0
- data/ext/asyncengine/libuv/common.gypi +4 -4
- data/ext/asyncengine/libuv/config-mingw.mk +6 -6
- data/ext/asyncengine/libuv/config-unix.mk +13 -13
- data/ext/asyncengine/libuv/gyp_uv +5 -1
- data/ext/asyncengine/libuv/ibc_tests/exec_test.sh +8 -0
- data/ext/asyncengine/libuv/ibc_tests/uv_shutdown_write_issue.c +171 -0
- data/ext/asyncengine/libuv/ibc_tests/uv_tcp_close_while_connecting.c +102 -0
- data/ext/asyncengine/libuv/include/uv-private/ngx-queue.h +3 -1
- data/ext/asyncengine/libuv/include/uv-private/uv-unix.h +103 -50
- data/ext/asyncengine/libuv/include/uv-private/uv-win.h +76 -24
- data/ext/asyncengine/libuv/include/uv.h +353 -88
- data/ext/asyncengine/libuv/src/ares/ares__close_sockets.o +0 -0
- data/ext/asyncengine/libuv/src/ares/ares__get_hostent.o +0 -0
- data/ext/asyncengine/libuv/src/ares/ares__read_line.o +0 -0
- data/ext/asyncengine/libuv/src/ares/ares__timeval.o +0 -0
- data/ext/asyncengine/libuv/src/ares/ares_cancel.o +0 -0
- data/ext/asyncengine/libuv/src/ares/ares_data.o +0 -0
- data/ext/asyncengine/libuv/src/ares/ares_destroy.o +0 -0
- data/ext/asyncengine/libuv/src/ares/ares_expand_name.o +0 -0
- data/ext/asyncengine/libuv/src/ares/ares_expand_string.o +0 -0
- data/ext/asyncengine/libuv/src/ares/ares_fds.o +0 -0
- data/ext/asyncengine/libuv/src/ares/ares_free_hostent.o +0 -0
- data/ext/asyncengine/libuv/src/ares/ares_free_string.o +0 -0
- data/ext/asyncengine/libuv/src/ares/ares_gethostbyaddr.o +0 -0
- data/ext/asyncengine/libuv/src/ares/ares_gethostbyname.o +0 -0
- data/ext/asyncengine/libuv/src/ares/ares_getnameinfo.o +0 -0
- data/ext/asyncengine/libuv/src/ares/ares_getopt.o +0 -0
- data/ext/asyncengine/libuv/src/ares/ares_getsock.o +0 -0
- data/ext/asyncengine/libuv/src/ares/ares_init.o +0 -0
- data/ext/asyncengine/libuv/src/ares/ares_library_init.o +0 -0
- data/ext/asyncengine/libuv/src/ares/ares_llist.o +0 -0
- data/ext/asyncengine/libuv/src/ares/ares_mkquery.o +0 -0
- data/ext/asyncengine/libuv/src/ares/ares_nowarn.o +0 -0
- data/ext/asyncengine/libuv/src/ares/ares_options.o +0 -0
- data/ext/asyncengine/libuv/src/ares/ares_parse_a_reply.o +0 -0
- data/ext/asyncengine/libuv/src/ares/ares_parse_aaaa_reply.o +0 -0
- data/ext/asyncengine/libuv/src/ares/ares_parse_mx_reply.o +0 -0
- data/ext/asyncengine/libuv/src/ares/ares_parse_ns_reply.o +0 -0
- data/ext/asyncengine/libuv/src/ares/ares_parse_ptr_reply.o +0 -0
- data/ext/asyncengine/libuv/src/ares/ares_parse_srv_reply.o +0 -0
- data/ext/asyncengine/libuv/src/ares/ares_parse_txt_reply.o +0 -0
- data/ext/asyncengine/libuv/src/ares/ares_process.o +0 -0
- data/ext/asyncengine/libuv/src/ares/ares_query.o +0 -0
- data/ext/asyncengine/libuv/src/ares/ares_search.o +0 -0
- data/ext/asyncengine/libuv/src/ares/ares_send.o +0 -0
- data/ext/asyncengine/libuv/src/ares/ares_strcasecmp.o +0 -0
- data/ext/asyncengine/libuv/src/ares/ares_strdup.o +0 -0
- data/ext/asyncengine/libuv/src/ares/ares_strerror.o +0 -0
- data/ext/asyncengine/libuv/src/ares/ares_timeout.o +0 -0
- data/ext/asyncengine/libuv/src/ares/ares_version.o +0 -0
- data/ext/asyncengine/libuv/src/ares/ares_writev.o +0 -0
- data/ext/asyncengine/libuv/src/ares/bitncmp.o +0 -0
- data/ext/asyncengine/libuv/src/ares/inet_net_pton.o +0 -0
- data/ext/asyncengine/libuv/src/ares/inet_ntop.o +0 -0
- data/ext/asyncengine/libuv/src/cares.c +225 -0
- data/ext/asyncengine/libuv/src/cares.o +0 -0
- data/ext/asyncengine/libuv/src/fs-poll.c +237 -0
- data/ext/asyncengine/libuv/src/fs-poll.o +0 -0
- data/ext/asyncengine/libuv/src/unix/async.c +78 -17
- data/ext/asyncengine/libuv/src/unix/async.o +0 -0
- data/ext/asyncengine/libuv/src/unix/core.c +305 -213
- data/ext/asyncengine/libuv/src/unix/core.o +0 -0
- data/ext/asyncengine/libuv/src/unix/cygwin.c +1 -1
- data/ext/asyncengine/libuv/src/unix/darwin.c +2 -1
- data/ext/asyncengine/libuv/src/unix/dl.c +36 -44
- data/ext/asyncengine/libuv/src/unix/dl.o +0 -0
- data/ext/asyncengine/libuv/src/unix/eio/eio.o +0 -0
- data/ext/asyncengine/libuv/src/unix/error.c +6 -0
- data/ext/asyncengine/libuv/src/unix/error.o +0 -0
- data/ext/asyncengine/libuv/src/unix/ev/ev.c +8 -4
- data/ext/asyncengine/libuv/src/unix/ev/ev.o +0 -0
- data/ext/asyncengine/libuv/src/unix/freebsd.c +1 -1
- data/ext/asyncengine/libuv/src/unix/fs.c +25 -33
- data/ext/asyncengine/libuv/src/unix/fs.o +0 -0
- data/ext/asyncengine/libuv/src/unix/internal.h +50 -31
- data/ext/asyncengine/libuv/src/unix/kqueue.c +2 -7
- data/ext/asyncengine/libuv/src/unix/linux/core.o +0 -0
- data/ext/asyncengine/libuv/src/unix/linux/inotify.c +12 -14
- data/ext/asyncengine/libuv/src/unix/linux/inotify.o +0 -0
- data/ext/asyncengine/libuv/src/unix/linux/{core.c → linux-core.c} +1 -1
- data/ext/asyncengine/libuv/src/unix/linux/linux-core.o +0 -0
- data/ext/asyncengine/libuv/src/unix/linux/syscalls.c +147 -1
- data/ext/asyncengine/libuv/src/unix/linux/syscalls.h +39 -2
- data/ext/asyncengine/libuv/src/unix/linux/syscalls.o +0 -0
- data/ext/asyncengine/libuv/src/unix/loop-watcher.c +63 -0
- data/ext/asyncengine/libuv/src/unix/loop-watcher.o +0 -0
- data/ext/asyncengine/libuv/src/unix/loop.c +29 -6
- data/ext/asyncengine/libuv/src/unix/loop.o +0 -0
- data/ext/asyncengine/libuv/src/unix/netbsd.c +1 -1
- data/ext/asyncengine/libuv/src/unix/openbsd.c +1 -1
- data/ext/asyncengine/libuv/src/unix/pipe.c +31 -36
- data/ext/asyncengine/libuv/src/unix/pipe.o +0 -0
- data/ext/asyncengine/libuv/src/unix/poll.c +116 -0
- data/ext/asyncengine/libuv/src/unix/poll.o +0 -0
- data/ext/asyncengine/libuv/src/unix/process.c +193 -115
- data/ext/asyncengine/libuv/src/unix/process.o +0 -0
- data/ext/asyncengine/libuv/src/unix/stream.c +146 -153
- data/ext/asyncengine/libuv/src/unix/stream.o +0 -0
- data/ext/asyncengine/libuv/src/unix/sunos.c +45 -36
- data/ext/asyncengine/libuv/src/unix/tcp.c +6 -5
- data/ext/asyncengine/libuv/src/unix/tcp.o +0 -0
- data/ext/asyncengine/libuv/src/unix/thread.c +82 -25
- data/ext/asyncengine/libuv/src/unix/thread.o +0 -0
- data/ext/asyncengine/libuv/src/unix/timer.c +69 -58
- data/ext/asyncengine/libuv/src/unix/timer.o +0 -0
- data/ext/asyncengine/libuv/src/unix/tty.c +3 -3
- data/ext/asyncengine/libuv/src/unix/tty.o +0 -0
- data/ext/asyncengine/libuv/src/unix/udp.c +57 -66
- data/ext/asyncengine/libuv/src/unix/udp.o +0 -0
- data/ext/asyncengine/libuv/src/unix/uv-eio.c +33 -50
- data/ext/asyncengine/libuv/src/unix/uv-eio.o +0 -0
- data/ext/asyncengine/libuv/src/uv-common.c +68 -38
- data/ext/asyncengine/libuv/src/uv-common.h +104 -20
- data/ext/asyncengine/libuv/src/uv-common.o +0 -0
- data/ext/asyncengine/libuv/src/win/async.c +20 -17
- data/ext/asyncengine/libuv/src/win/core.c +44 -31
- data/ext/asyncengine/libuv/src/win/dl.c +40 -36
- data/ext/asyncengine/libuv/src/win/error.c +21 -1
- data/ext/asyncengine/libuv/src/win/fs-event.c +19 -21
- data/ext/asyncengine/libuv/src/win/fs.c +541 -189
- data/ext/asyncengine/libuv/src/win/getaddrinfo.c +56 -63
- data/ext/asyncengine/libuv/src/win/handle-inl.h +145 -0
- data/ext/asyncengine/libuv/src/win/handle.c +26 -101
- data/ext/asyncengine/libuv/src/win/internal.h +92 -107
- data/ext/asyncengine/libuv/src/win/loop-watcher.c +6 -14
- data/ext/asyncengine/libuv/src/win/pipe.c +78 -64
- data/ext/asyncengine/libuv/src/win/poll.c +618 -0
- data/ext/asyncengine/libuv/src/win/process-stdio.c +479 -0
- data/ext/asyncengine/libuv/src/win/process.c +147 -274
- data/ext/asyncengine/libuv/src/win/req-inl.h +225 -0
- data/ext/asyncengine/libuv/src/win/req.c +0 -149
- data/ext/asyncengine/libuv/src/{unix/check.c → win/stream-inl.h} +31 -42
- data/ext/asyncengine/libuv/src/win/stream.c +9 -43
- data/ext/asyncengine/libuv/src/win/tcp.c +200 -82
- data/ext/asyncengine/libuv/src/win/thread.c +42 -2
- data/ext/asyncengine/libuv/src/win/threadpool.c +3 -2
- data/ext/asyncengine/libuv/src/win/timer.c +13 -63
- data/ext/asyncengine/libuv/src/win/tty.c +26 -20
- data/ext/asyncengine/libuv/src/win/udp.c +26 -17
- data/ext/asyncengine/libuv/src/win/util.c +312 -167
- data/ext/asyncengine/libuv/src/win/winapi.c +16 -1
- data/ext/asyncengine/libuv/src/win/winapi.h +33 -9
- data/ext/asyncengine/libuv/src/win/winsock.c +88 -1
- data/ext/asyncengine/libuv/src/win/winsock.h +36 -3
- data/ext/asyncengine/libuv/test/benchmark-ares.c +16 -17
- data/ext/asyncengine/libuv/test/benchmark-fs-stat.c +164 -0
- data/ext/asyncengine/libuv/test/benchmark-list.h +9 -0
- data/ext/asyncengine/libuv/{src/unix/prepare.c → test/benchmark-loop-count.c} +42 -33
- data/ext/asyncengine/libuv/test/benchmark-million-timers.c +65 -0
- data/ext/asyncengine/libuv/test/benchmark-pound.c +1 -1
- data/ext/asyncengine/libuv/test/benchmark-sizes.c +2 -0
- data/ext/asyncengine/libuv/test/benchmark-spawn.c +7 -1
- data/ext/asyncengine/libuv/test/benchmark-udp-packet-storm.c +1 -1
- data/ext/asyncengine/libuv/test/echo-server.c +8 -0
- data/ext/asyncengine/libuv/test/run-tests.c +30 -0
- data/ext/asyncengine/libuv/test/runner-unix.c +6 -26
- data/ext/asyncengine/libuv/test/runner-win.c +5 -63
- data/ext/asyncengine/libuv/test/runner.c +10 -1
- data/ext/asyncengine/libuv/test/task.h +0 -8
- data/ext/asyncengine/libuv/test/test-async.c +43 -141
- data/ext/asyncengine/libuv/test/test-callback-order.c +76 -0
- data/ext/asyncengine/libuv/test/test-counters-init.c +2 -3
- data/ext/asyncengine/libuv/test/test-dlerror.c +17 -8
- data/ext/asyncengine/libuv/test/test-fs-event.c +31 -39
- data/ext/asyncengine/libuv/test/test-fs-poll.c +146 -0
- data/ext/asyncengine/libuv/test/test-fs.c +114 -2
- data/ext/asyncengine/libuv/test/test-gethostbyname.c +8 -8
- data/ext/asyncengine/libuv/test/test-hrtime.c +18 -15
- data/ext/asyncengine/libuv/test/test-ipc.c +8 -2
- data/ext/asyncengine/libuv/test/test-list.h +59 -9
- data/ext/asyncengine/libuv/test/test-loop-handles.c +2 -25
- data/ext/asyncengine/libuv/{src/unix/idle.c → test/test-poll-close.c} +37 -39
- data/ext/asyncengine/libuv/test/test-poll.c +573 -0
- data/ext/asyncengine/libuv/test/test-ref.c +79 -63
- data/ext/asyncengine/libuv/test/test-run-once.c +15 -11
- data/ext/asyncengine/libuv/test/test-semaphore.c +111 -0
- data/ext/asyncengine/libuv/test/test-spawn.c +368 -20
- data/ext/asyncengine/libuv/test/test-stdio-over-pipes.c +25 -35
- data/ext/asyncengine/libuv/test/test-tcp-close-while-connecting.c +80 -0
- data/ext/asyncengine/libuv/test/test-tcp-close.c +1 -1
- data/ext/asyncengine/libuv/test/test-tcp-connect-error-after-write.c +95 -0
- data/ext/asyncengine/libuv/test/test-tcp-connect-timeout.c +85 -0
- data/ext/asyncengine/libuv/test/test-tcp-shutdown-after-write.c +131 -0
- data/ext/asyncengine/libuv/test/test-tcp-write-error.c +2 -2
- data/ext/asyncengine/libuv/test/test-tcp-writealot.c +29 -54
- data/ext/asyncengine/libuv/test/test-timer-again.c +1 -1
- data/ext/asyncengine/libuv/test/test-timer.c +23 -1
- data/ext/asyncengine/libuv/test/test-udp-options.c +1 -1
- data/ext/asyncengine/libuv/test/{test-eio-overflow.c → test-walk-handles.c} +31 -44
- data/ext/asyncengine/libuv/uv.gyp +26 -9
- data/ext/asyncengine/rb_utilities.c +54 -0
- data/ext/asyncengine/rb_utilities.h +63 -0
- data/lib/asyncengine.rb +45 -38
- data/lib/asyncengine/asyncengine_ext.so +0 -0
- data/lib/asyncengine/debug.rb +37 -0
- data/lib/asyncengine/handle.rb +9 -0
- data/lib/asyncengine/tcp.rb +28 -0
- data/lib/asyncengine/timer.rb +18 -28
- data/lib/asyncengine/udp.rb +29 -0
- data/lib/asyncengine/utils.rb +32 -0
- data/lib/asyncengine/uv_error.rb +17 -0
- data/lib/asyncengine/version.rb +9 -1
- data/test/ae_test_helper.rb +62 -0
- data/test/test_basic.rb +169 -0
- data/test/test_call_from_other_thread.rb +55 -0
- data/test/test_error.rb +92 -0
- data/test/test_ip_utils.rb +44 -0
- data/test/test_next_tick.rb +37 -0
- data/test/test_resolver.rb +51 -0
- data/test/test_threads.rb +69 -0
- data/test/test_timer.rb +95 -0
- data/test/test_udp.rb +216 -0
- data/test/test_utils.rb +49 -0
- metadata +84 -57
- data/ext/asyncengine/libuv/mkmf.log +0 -24
- data/ext/asyncengine/libuv/src/unix/cares.c +0 -194
- data/ext/asyncengine/libuv/src/unix/cares.o +0 -0
- data/ext/asyncengine/libuv/src/unix/check.o +0 -0
- data/ext/asyncengine/libuv/src/unix/idle.o +0 -0
- data/ext/asyncengine/libuv/src/unix/prepare.o +0 -0
- data/ext/asyncengine/libuv/src/win/cares.c +0 -290
- data/lib/asyncengine/errors.rb +0 -5
- data/lib/asyncengine/next_tick.rb +0 -24
metadata
CHANGED
@@ -1,58 +1,71 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: asyncengine
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
|
6
|
-
- 0
|
7
|
-
- 0
|
8
|
-
- 1
|
9
|
-
- testing1
|
10
|
-
version: 0.0.1.testing1
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.2.alpha1
|
5
|
+
prerelease: 6
|
11
6
|
platform: ruby
|
12
|
-
authors:
|
7
|
+
authors:
|
13
8
|
- Inaki Baz Castillo
|
14
9
|
autorequire:
|
15
10
|
bindir: bin
|
16
11
|
cert_chain: []
|
17
|
-
|
18
|
-
date: 2012-05-02 00:00:00 +02:00
|
19
|
-
default_executable:
|
12
|
+
date: 2012-06-27 00:00:00.000000000 Z
|
20
13
|
dependencies: []
|
21
|
-
|
22
|
-
description: Ruby asynchronous event driven library based on libuv
|
14
|
+
description: Ruby asynchronous event driven framework on top of libuv
|
23
15
|
email: ibc@aliax.net
|
24
16
|
executables: []
|
25
|
-
|
26
|
-
extensions:
|
17
|
+
extensions:
|
27
18
|
- ext/asyncengine/extconf.rb
|
28
19
|
extra_rdoc_files: []
|
29
|
-
|
30
|
-
files:
|
20
|
+
files:
|
31
21
|
- asyncengine.gemspec
|
22
|
+
- Rakefile
|
32
23
|
- README.markdown
|
33
|
-
- lib/asyncengine/
|
24
|
+
- lib/asyncengine/utils.rb
|
25
|
+
- lib/asyncengine/debug.rb
|
26
|
+
- lib/asyncengine/uv_error.rb
|
34
27
|
- lib/asyncengine/timer.rb
|
35
28
|
- lib/asyncengine/udp.rb
|
36
|
-
- lib/asyncengine/
|
29
|
+
- lib/asyncengine/tcp.rb
|
30
|
+
- lib/asyncengine/handle.rb
|
37
31
|
- lib/asyncengine/version.rb
|
38
32
|
- lib/asyncengine/asyncengine_ext.so
|
39
33
|
- lib/asyncengine.rb
|
34
|
+
- ext/asyncengine/rb_utilities.c
|
40
35
|
- ext/asyncengine/ae_udp.c
|
41
36
|
- ext/asyncengine/asyncengine_ruby.c
|
42
37
|
- ext/asyncengine/ae_next_tick.c
|
43
38
|
- ext/asyncengine/ae_handle_common.c
|
39
|
+
- ext/asyncengine/ae_resolver.c
|
40
|
+
- ext/asyncengine/ae_tcp.c
|
41
|
+
- ext/asyncengine/ae_utils.c
|
42
|
+
- ext/asyncengine/ip_parser.c
|
43
|
+
- ext/asyncengine/ae_call_from_other_thread.c
|
44
|
+
- ext/asyncengine/ae_ip_utils.c
|
44
45
|
- ext/asyncengine/ae_timer.c
|
46
|
+
- ext/asyncengine/ae_resolver.h
|
45
47
|
- ext/asyncengine/ae_handle_common.h
|
48
|
+
- ext/asyncengine/ae_utils.h
|
46
49
|
- ext/asyncengine/ae_timer.h
|
50
|
+
- ext/asyncengine/ip_parser.h
|
51
|
+
- ext/asyncengine/ae_tcp.h
|
47
52
|
- ext/asyncengine/asyncengine_ruby.h
|
53
|
+
- ext/asyncengine/ae_call_from_other_thread.h
|
54
|
+
- ext/asyncengine/rb_utilities.h
|
55
|
+
- ext/asyncengine/ae_ip_utils.h
|
48
56
|
- ext/asyncengine/ae_next_tick.h
|
57
|
+
- ext/asyncengine/debug.h
|
49
58
|
- ext/asyncengine/ae_udp.h
|
50
59
|
- ext/asyncengine/extconf.rb
|
51
60
|
- ext/asyncengine/libuv/README.md
|
52
61
|
- ext/asyncengine/libuv/gyp_uv
|
53
62
|
- ext/asyncengine/libuv/config-unix.mk
|
54
63
|
- ext/asyncengine/libuv/common.gypi
|
64
|
+
- ext/asyncengine/libuv/ibc_tests/uv_shutdown_write_issue.c
|
65
|
+
- ext/asyncengine/libuv/ibc_tests/exec_test.sh
|
66
|
+
- ext/asyncengine/libuv/ibc_tests/uv_tcp_close_while_connecting.c
|
55
67
|
- ext/asyncengine/libuv/test/test-list.h
|
68
|
+
- ext/asyncengine/libuv/test/benchmark-loop-count.c
|
56
69
|
- ext/asyncengine/libuv/test/test-fs-event.c
|
57
70
|
- ext/asyncengine/libuv/test/test-getsockname.c
|
58
71
|
- ext/asyncengine/libuv/test/benchmark-spawn.c
|
@@ -66,6 +79,7 @@ files:
|
|
66
79
|
- ext/asyncengine/libuv/test/test-fail-always.c
|
67
80
|
- ext/asyncengine/libuv/test/test-ref.c
|
68
81
|
- ext/asyncengine/libuv/test/task.h
|
82
|
+
- ext/asyncengine/libuv/test/test-tcp-connect-error-after-write.c
|
69
83
|
- ext/asyncengine/libuv/test/test-thread.c
|
70
84
|
- ext/asyncengine/libuv/test/test-ipc-send-recv.c
|
71
85
|
- ext/asyncengine/libuv/test/test-udp-dgram-too-big.c
|
@@ -74,6 +88,7 @@ files:
|
|
74
88
|
- ext/asyncengine/libuv/test/test-callback-stack.c
|
75
89
|
- ext/asyncengine/libuv/test/benchmark-pump.c
|
76
90
|
- ext/asyncengine/libuv/test/test-udp-multicast-join.c
|
91
|
+
- ext/asyncengine/libuv/test/test-callback-order.c
|
77
92
|
- ext/asyncengine/libuv/test/test-tcp-flags.c
|
78
93
|
- ext/asyncengine/libuv/test/test-mutexes.c
|
79
94
|
- ext/asyncengine/libuv/test/test-tcp-writealot.c
|
@@ -86,9 +101,11 @@ files:
|
|
86
101
|
- ext/asyncengine/libuv/test/test-platform-output.c
|
87
102
|
- ext/asyncengine/libuv/test/test-getaddrinfo.c
|
88
103
|
- ext/asyncengine/libuv/test/runner-win.c
|
104
|
+
- ext/asyncengine/libuv/test/test-tcp-close-while-connecting.c
|
89
105
|
- ext/asyncengine/libuv/test/test-timer.c
|
90
106
|
- ext/asyncengine/libuv/test/test-cwd-and-chdir.c
|
91
107
|
- ext/asyncengine/libuv/test/test-ipc.c
|
108
|
+
- ext/asyncengine/libuv/test/test-tcp-connect-timeout.c
|
92
109
|
- ext/asyncengine/libuv/test/test-tcp-bind-error.c
|
93
110
|
- ext/asyncengine/libuv/test/benchmark-list.h
|
94
111
|
- ext/asyncengine/libuv/test/test-udp-ipv6.c
|
@@ -97,8 +114,10 @@ files:
|
|
97
114
|
- ext/asyncengine/libuv/test/benchmark-tcp-write-batch.c
|
98
115
|
- ext/asyncengine/libuv/test/test-hrtime.c
|
99
116
|
- ext/asyncengine/libuv/test/test-tcp-bind6-error.c
|
117
|
+
- ext/asyncengine/libuv/test/test-fs-poll.c
|
100
118
|
- ext/asyncengine/libuv/test/echo-server.c
|
101
119
|
- ext/asyncengine/libuv/test/test-spawn.c
|
120
|
+
- ext/asyncengine/libuv/test/test-tcp-shutdown-after-write.c
|
102
121
|
- ext/asyncengine/libuv/test/blackhole-server.c
|
103
122
|
- ext/asyncengine/libuv/test/test-connection-fail.c
|
104
123
|
- ext/asyncengine/libuv/test/benchmark-pound.c
|
@@ -111,6 +130,7 @@ files:
|
|
111
130
|
- ext/asyncengine/libuv/test/test-ping-pong.c
|
112
131
|
- ext/asyncengine/libuv/test/test-udp-multicast-ttl.c
|
113
132
|
- ext/asyncengine/libuv/test/test-fs.c
|
133
|
+
- ext/asyncengine/libuv/test/benchmark-million-timers.c
|
114
134
|
- ext/asyncengine/libuv/test/test-shutdown-eof.c
|
115
135
|
- ext/asyncengine/libuv/test/benchmark-ares.c
|
116
136
|
- ext/asyncengine/libuv/test/runner.c
|
@@ -121,19 +141,23 @@ files:
|
|
121
141
|
- ext/asyncengine/libuv/test/benchmark-getaddrinfo.c
|
122
142
|
- ext/asyncengine/libuv/test/test-timer-again.c
|
123
143
|
- ext/asyncengine/libuv/test/run-benchmarks.c
|
144
|
+
- ext/asyncengine/libuv/test/test-semaphore.c
|
124
145
|
- ext/asyncengine/libuv/test/fixtures/load_error.node
|
125
146
|
- ext/asyncengine/libuv/test/fixtures/empty_file
|
126
147
|
- ext/asyncengine/libuv/test/test-dlerror.c
|
127
148
|
- ext/asyncengine/libuv/test/test-get-currentexe.c
|
128
149
|
- ext/asyncengine/libuv/test/test-counters-init.c
|
150
|
+
- ext/asyncengine/libuv/test/test-walk-handles.c
|
129
151
|
- ext/asyncengine/libuv/test/benchmark-ping-pongs.c
|
130
152
|
- ext/asyncengine/libuv/test/test-run-once.c
|
131
153
|
- ext/asyncengine/libuv/test/runner-unix.c
|
154
|
+
- ext/asyncengine/libuv/test/test-poll-close.c
|
132
155
|
- ext/asyncengine/libuv/test/test-util.c
|
133
156
|
- ext/asyncengine/libuv/test/test-udp-options.c
|
134
157
|
- ext/asyncengine/libuv/test/runner-win.h
|
158
|
+
- ext/asyncengine/libuv/test/benchmark-fs-stat.c
|
159
|
+
- ext/asyncengine/libuv/test/test-poll.c
|
135
160
|
- ext/asyncengine/libuv/test/test-pass-always.c
|
136
|
-
- ext/asyncengine/libuv/test/test-eio-overflow.c
|
137
161
|
- ext/asyncengine/libuv/test/dns-server.c
|
138
162
|
- ext/asyncengine/libuv/test/test-idle.c
|
139
163
|
- ext/asyncengine/libuv/AUTHORS
|
@@ -151,27 +175,27 @@ files:
|
|
151
175
|
- ext/asyncengine/libuv/src/unix/cygwin.c
|
152
176
|
- ext/asyncengine/libuv/src/unix/timer.c
|
153
177
|
- ext/asyncengine/libuv/src/unix/tty.c
|
154
|
-
- ext/asyncengine/libuv/src/unix/check.c
|
155
178
|
- ext/asyncengine/libuv/src/unix/udp.c
|
156
179
|
- ext/asyncengine/libuv/src/unix/stream.c
|
157
180
|
- ext/asyncengine/libuv/src/unix/core.o
|
181
|
+
- ext/asyncengine/libuv/src/unix/poll.o
|
182
|
+
- ext/asyncengine/libuv/src/unix/loop-watcher.o
|
158
183
|
- ext/asyncengine/libuv/src/unix/thread.c
|
159
184
|
- ext/asyncengine/libuv/src/unix/core.c
|
160
185
|
- ext/asyncengine/libuv/src/unix/uv-eio.c
|
161
|
-
- ext/asyncengine/libuv/src/unix/idle.c
|
162
186
|
- ext/asyncengine/libuv/src/unix/tty.o
|
163
187
|
- ext/asyncengine/libuv/src/unix/netbsd.c
|
164
188
|
- ext/asyncengine/libuv/src/unix/async.c
|
165
189
|
- ext/asyncengine/libuv/src/unix/openbsd.c
|
166
190
|
- ext/asyncengine/libuv/src/unix/error.o
|
167
191
|
- ext/asyncengine/libuv/src/unix/process.c
|
168
|
-
- ext/asyncengine/libuv/src/unix/prepare.c
|
169
192
|
- ext/asyncengine/libuv/src/unix/sunos.c
|
170
193
|
- ext/asyncengine/libuv/src/unix/dl.c
|
171
194
|
- ext/asyncengine/libuv/src/unix/error.c
|
172
195
|
- ext/asyncengine/libuv/src/unix/timer.o
|
173
196
|
- ext/asyncengine/libuv/src/unix/internal.h
|
174
197
|
- ext/asyncengine/libuv/src/unix/uv-eio.o
|
198
|
+
- ext/asyncengine/libuv/src/unix/poll.c
|
175
199
|
- ext/asyncengine/libuv/src/unix/ev/libev.m4
|
176
200
|
- ext/asyncengine/libuv/src/unix/ev/event.c
|
177
201
|
- ext/asyncengine/libuv/src/unix/ev/ev_win32.c
|
@@ -212,24 +236,22 @@ files:
|
|
212
236
|
- ext/asyncengine/libuv/src/unix/ev/missing
|
213
237
|
- ext/asyncengine/libuv/src/unix/ev/config.guess
|
214
238
|
- ext/asyncengine/libuv/src/unix/ev/depcomp
|
215
|
-
- ext/asyncengine/libuv/src/unix/cares.o
|
216
239
|
- ext/asyncengine/libuv/src/unix/fs.o
|
217
240
|
- ext/asyncengine/libuv/src/unix/udp.o
|
241
|
+
- ext/asyncengine/libuv/src/unix/loop-watcher.c
|
218
242
|
- ext/asyncengine/libuv/src/unix/linux/core.o
|
219
243
|
- ext/asyncengine/libuv/src/unix/linux/inotify.c
|
220
|
-
- ext/asyncengine/libuv/src/unix/linux/core.c
|
221
244
|
- ext/asyncengine/libuv/src/unix/linux/syscalls.c
|
245
|
+
- ext/asyncengine/libuv/src/unix/linux/linux-core.c
|
222
246
|
- ext/asyncengine/libuv/src/unix/linux/syscalls.h
|
223
247
|
- ext/asyncengine/libuv/src/unix/linux/syscalls.o
|
248
|
+
- ext/asyncengine/libuv/src/unix/linux/linux-core.o
|
224
249
|
- ext/asyncengine/libuv/src/unix/linux/inotify.o
|
225
|
-
- ext/asyncengine/libuv/src/unix/idle.o
|
226
250
|
- ext/asyncengine/libuv/src/unix/process.o
|
227
251
|
- ext/asyncengine/libuv/src/unix/pipe.o
|
228
|
-
- ext/asyncengine/libuv/src/unix/cares.c
|
229
252
|
- ext/asyncengine/libuv/src/unix/thread.o
|
230
253
|
- ext/asyncengine/libuv/src/unix/pipe.c
|
231
254
|
- ext/asyncengine/libuv/src/unix/darwin.c
|
232
|
-
- ext/asyncengine/libuv/src/unix/check.o
|
233
255
|
- ext/asyncengine/libuv/src/unix/kqueue.c
|
234
256
|
- ext/asyncengine/libuv/src/unix/fs.c
|
235
257
|
- ext/asyncengine/libuv/src/unix/uv-eio.h
|
@@ -257,13 +279,13 @@ files:
|
|
257
279
|
- ext/asyncengine/libuv/src/unix/eio/config_cygwin.h
|
258
280
|
- ext/asyncengine/libuv/src/unix/eio/LICENSE
|
259
281
|
- ext/asyncengine/libuv/src/unix/freebsd.c
|
260
|
-
- ext/asyncengine/libuv/src/unix/prepare.o
|
261
282
|
- ext/asyncengine/libuv/src/unix/tcp.o
|
262
283
|
- ext/asyncengine/libuv/src/unix/dl.o
|
263
284
|
- ext/asyncengine/libuv/src/unix/loop.c
|
264
285
|
- ext/asyncengine/libuv/src/unix/async.o
|
265
286
|
- ext/asyncengine/libuv/src/unix/loop.o
|
266
287
|
- ext/asyncengine/libuv/src/unix/tcp.c
|
288
|
+
- ext/asyncengine/libuv/src/fs-poll.o
|
267
289
|
- ext/asyncengine/libuv/src/uv-common.h
|
268
290
|
- ext/asyncengine/libuv/src/win/winapi.h
|
269
291
|
- ext/asyncengine/libuv/src/win/timer.c
|
@@ -273,10 +295,12 @@ files:
|
|
273
295
|
- ext/asyncengine/libuv/src/win/req.c
|
274
296
|
- ext/asyncengine/libuv/src/win/thread.c
|
275
297
|
- ext/asyncengine/libuv/src/win/winsock.c
|
298
|
+
- ext/asyncengine/libuv/src/win/req-inl.h
|
276
299
|
- ext/asyncengine/libuv/src/win/util.c
|
277
300
|
- ext/asyncengine/libuv/src/win/core.c
|
278
301
|
- ext/asyncengine/libuv/src/win/winapi.c
|
279
302
|
- ext/asyncengine/libuv/src/win/fs-event.c
|
303
|
+
- ext/asyncengine/libuv/src/win/process-stdio.c
|
280
304
|
- ext/asyncengine/libuv/src/win/async.c
|
281
305
|
- ext/asyncengine/libuv/src/win/process.c
|
282
306
|
- ext/asyncengine/libuv/src/win/threadpool.c
|
@@ -284,13 +308,18 @@ files:
|
|
284
308
|
- ext/asyncengine/libuv/src/win/error.c
|
285
309
|
- ext/asyncengine/libuv/src/win/internal.h
|
286
310
|
- ext/asyncengine/libuv/src/win/handle.c
|
311
|
+
- ext/asyncengine/libuv/src/win/poll.c
|
287
312
|
- ext/asyncengine/libuv/src/win/loop-watcher.c
|
288
|
-
- ext/asyncengine/libuv/src/win/cares.c
|
289
313
|
- ext/asyncengine/libuv/src/win/pipe.c
|
290
314
|
- ext/asyncengine/libuv/src/win/winsock.h
|
291
315
|
- ext/asyncengine/libuv/src/win/fs.c
|
316
|
+
- ext/asyncengine/libuv/src/win/stream-inl.h
|
317
|
+
- ext/asyncengine/libuv/src/win/handle-inl.h
|
292
318
|
- ext/asyncengine/libuv/src/win/getaddrinfo.c
|
293
319
|
- ext/asyncengine/libuv/src/win/tcp.c
|
320
|
+
- ext/asyncengine/libuv/src/cares.o
|
321
|
+
- ext/asyncengine/libuv/src/cares.c
|
322
|
+
- ext/asyncengine/libuv/src/fs-poll.c
|
294
323
|
- ext/asyncengine/libuv/src/uv-common.c
|
295
324
|
- ext/asyncengine/libuv/src/ares/ares_expand_name.o
|
296
325
|
- ext/asyncengine/libuv/src/ares/ares_getenv.h
|
@@ -425,43 +454,41 @@ files:
|
|
425
454
|
- ext/asyncengine/libuv/build/gcc_version.py
|
426
455
|
- ext/asyncengine/libuv/config-mingw.mk
|
427
456
|
- ext/asyncengine/libuv/LICENSE
|
428
|
-
- ext/asyncengine/libuv/mkmf.log
|
429
457
|
- ext/asyncengine/libuv/uv.gyp
|
430
|
-
|
458
|
+
- test/ae_test_helper.rb
|
459
|
+
- test/test_ip_utils.rb
|
460
|
+
- test/test_resolver.rb
|
461
|
+
- test/test_next_tick.rb
|
462
|
+
- test/test_timer.rb
|
463
|
+
- test/test_threads.rb
|
464
|
+
- test/test_basic.rb
|
465
|
+
- test/test_call_from_other_thread.rb
|
466
|
+
- test/test_error.rb
|
467
|
+
- test/test_utils.rb
|
468
|
+
- test/test_udp.rb
|
431
469
|
homepage: https://github.com/ibc/AsyncEngine
|
432
470
|
licenses: []
|
433
|
-
|
434
471
|
post_install_message:
|
435
472
|
rdoc_options: []
|
436
|
-
|
437
|
-
require_paths:
|
473
|
+
require_paths:
|
438
474
|
- lib
|
439
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
475
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
440
476
|
none: false
|
441
|
-
requirements:
|
442
|
-
- -
|
443
|
-
- !ruby/object:Gem::Version
|
444
|
-
segments:
|
445
|
-
- 1
|
446
|
-
- 9
|
447
|
-
- 2
|
477
|
+
requirements:
|
478
|
+
- - ! '>='
|
479
|
+
- !ruby/object:Gem::Version
|
448
480
|
version: 1.9.2
|
449
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
481
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
450
482
|
none: false
|
451
|
-
requirements:
|
452
|
-
- -
|
453
|
-
- !ruby/object:Gem::Version
|
454
|
-
segments:
|
455
|
-
- 1
|
456
|
-
- 3
|
457
|
-
- 1
|
483
|
+
requirements:
|
484
|
+
- - ! '>'
|
485
|
+
- !ruby/object:Gem::Version
|
458
486
|
version: 1.3.1
|
459
487
|
requirements: []
|
460
|
-
|
461
488
|
rubyforge_project:
|
462
|
-
rubygems_version: 1.
|
489
|
+
rubygems_version: 1.8.11
|
463
490
|
signing_key:
|
464
491
|
specification_version: 3
|
465
|
-
summary: Ruby asynchronous event driven
|
492
|
+
summary: Ruby asynchronous event driven framework on top of libuv
|
466
493
|
test_files: []
|
467
|
-
|
494
|
+
has_rdoc:
|
@@ -1,24 +0,0 @@
|
|
1
|
-
"CFLAGS='-shared -fPIC' make"
|
2
|
-
ar rcs uv.a src/unix/async.o src/unix/cares.o src/unix/check.o src/unix/core.o src/unix/dl.o src/unix/error.o src/unix/fs.o src/unix/idle.o src/unix/loop.o src/unix/pipe.o src/unix/prepare.o src/unix/process.o src/unix/stream.o src/unix/tcp.o src/unix/thread.o src/unix/timer.o src/unix/tty.o src/unix/udp.o src/unix/linux/core.o src/unix/linux/inotify.o src/unix/linux/syscalls.o src/uv-common.o src/unix/uv-eio.o src/unix/ev/ev.o src/unix/eio/eio.o src/ares/ares__close_sockets.o src/ares/ares__get_hostent.o src/ares/ares__read_line.o src/ares/ares__timeval.o src/ares/ares_cancel.o src/ares/ares_data.o src/ares/ares_destroy.o src/ares/ares_expand_name.o src/ares/ares_expand_string.o src/ares/ares_fds.o src/ares/ares_free_hostent.o src/ares/ares_free_string.o src/ares/ares_gethostbyaddr.o src/ares/ares_gethostbyname.o src/ares/ares_getnameinfo.o src/ares/ares_getopt.o src/ares/ares_getsock.o src/ares/ares_init.o src/ares/ares_library_init.o src/ares/ares_llist.o src/ares/ares_mkquery.o src/ares/ares_nowarn.o src/ares/ares_options.o src/ares/ares_parse_a_reply.o src/ares/ares_parse_aaaa_reply.o src/ares/ares_parse_mx_reply.o src/ares/ares_parse_ns_reply.o src/ares/ares_parse_ptr_reply.o src/ares/ares_parse_srv_reply.o src/ares/ares_parse_txt_reply.o src/ares/ares_process.o src/ares/ares_query.o src/ares/ares_search.o src/ares/ares_send.o src/ares/ares_strcasecmp.o src/ares/ares_strdup.o src/ares/ares_strerror.o src/ares/ares_timeout.o src/ares/ares_version.o src/ares/ares_writev.o src/ares/bitncmp.o src/ares/inet_net_pton.o src/ares/inet_ntop.o
|
3
|
-
have_library: checking for main() in -luv... -------------------- yes
|
4
|
-
|
5
|
-
"gcc -o conftest -I/usr/include/ruby-1.9.1/x86_64-linux -I/usr/include/ruby-1.9.1/ruby/backward -I/usr/include/ruby-1.9.1 -I. -shared -fPIC conftest.c -L. -L/usr/lib -lruby-1.9.1-static -lpthread -lrt -ldl -lcrypt -lm -lc"
|
6
|
-
checked program was:
|
7
|
-
/* begin */
|
8
|
-
1: #include "ruby.h"
|
9
|
-
2:
|
10
|
-
3: int main() {return 0;}
|
11
|
-
/* end */
|
12
|
-
|
13
|
-
"gcc -o conftest -I/usr/include/ruby-1.9.1/x86_64-linux -I/usr/include/ruby-1.9.1/ruby/backward -I/usr/include/ruby-1.9.1 -I. -shared -fPIC conftest.c -L. -L/usr/lib -lruby-1.9.1-static -luv -lpthread -lrt -ldl -lcrypt -lm -lc"
|
14
|
-
checked program was:
|
15
|
-
/* begin */
|
16
|
-
1: #include "ruby.h"
|
17
|
-
2:
|
18
|
-
3: /*top*/
|
19
|
-
4: int main() {return 0;}
|
20
|
-
5: int t() { void ((*volatile p)()); p = (void ((*)()))main; return 0; }
|
21
|
-
/* end */
|
22
|
-
|
23
|
-
--------------------
|
24
|
-
|
@@ -1,194 +0,0 @@
|
|
1
|
-
/* Copyright Joyent, Inc. and other Node contributors. All rights reserved.
|
2
|
-
*
|
3
|
-
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
4
|
-
* of this software and associated documentation files (the "Software"), to
|
5
|
-
* deal in the Software without restriction, including without limitation the
|
6
|
-
* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
|
7
|
-
* sell copies of the Software, and to permit persons to whom the Software is
|
8
|
-
* furnished to do so, subject to the following conditions:
|
9
|
-
*
|
10
|
-
* The above copyright notice and this permission notice shall be included in
|
11
|
-
* all copies or substantial portions of the Software.
|
12
|
-
*
|
13
|
-
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14
|
-
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
15
|
-
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
16
|
-
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
17
|
-
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
18
|
-
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
|
19
|
-
* IN THE SOFTWARE.
|
20
|
-
*/
|
21
|
-
|
22
|
-
#include "uv.h"
|
23
|
-
#include "internal.h"
|
24
|
-
|
25
|
-
#include <assert.h>
|
26
|
-
#include <errno.h>
|
27
|
-
#include <stdlib.h>
|
28
|
-
|
29
|
-
|
30
|
-
/*
|
31
|
-
* This is called once per second by loop->timer. It is used to
|
32
|
-
* constantly callback into c-ares for possibly processing timeouts.
|
33
|
-
*/
|
34
|
-
static void uv__ares_timeout(uv_timer_t* handle, int status) {
|
35
|
-
assert(!uv_ares_handles_empty(handle->loop));
|
36
|
-
ares_process_fd(handle->loop->channel, ARES_SOCKET_BAD, ARES_SOCKET_BAD);
|
37
|
-
}
|
38
|
-
|
39
|
-
|
40
|
-
static void uv__ares_timer_start(uv_loop_t* loop) {
|
41
|
-
if (uv_is_active((uv_handle_t*)&loop->timer)) return;
|
42
|
-
uv_timer_start(&loop->timer, uv__ares_timeout, 1000, 1000);
|
43
|
-
uv_ref(loop);
|
44
|
-
}
|
45
|
-
|
46
|
-
|
47
|
-
static void uv__ares_timer_stop(uv_loop_t* loop) {
|
48
|
-
if (!uv_is_active((uv_handle_t*)&loop->timer)) return;
|
49
|
-
uv_timer_stop(&loop->timer);
|
50
|
-
uv_unref(loop);
|
51
|
-
}
|
52
|
-
|
53
|
-
|
54
|
-
static void uv__ares_io(struct ev_loop* ev, struct ev_io* watcher,
|
55
|
-
int revents) {
|
56
|
-
uv_loop_t* loop = ev_userdata(ev);
|
57
|
-
|
58
|
-
assert(ev == loop->ev);
|
59
|
-
|
60
|
-
/* Reset the idle timer */
|
61
|
-
uv_timer_again(&loop->timer);
|
62
|
-
|
63
|
-
/* Process DNS responses */
|
64
|
-
ares_process_fd(loop->channel,
|
65
|
-
revents & EV_READ ? watcher->fd : ARES_SOCKET_BAD,
|
66
|
-
revents & EV_WRITE ? watcher->fd : ARES_SOCKET_BAD);
|
67
|
-
}
|
68
|
-
|
69
|
-
|
70
|
-
/* Allocates and returns a new uv_ares_task_t */
|
71
|
-
static uv_ares_task_t* uv__ares_task_create(uv_loop_t* loop, int fd) {
|
72
|
-
uv_ares_task_t* h = malloc(sizeof(uv_ares_task_t));
|
73
|
-
|
74
|
-
if (h == NULL) {
|
75
|
-
uv_fatal_error(ENOMEM, "malloc");
|
76
|
-
return NULL;
|
77
|
-
}
|
78
|
-
|
79
|
-
h->loop = loop;
|
80
|
-
h->sock = fd;
|
81
|
-
|
82
|
-
ev_io_init(&h->read_watcher, uv__ares_io, fd, EV_READ);
|
83
|
-
ev_io_init(&h->write_watcher, uv__ares_io, fd, EV_WRITE);
|
84
|
-
|
85
|
-
h->read_watcher.data = h;
|
86
|
-
h->write_watcher.data = h;
|
87
|
-
|
88
|
-
return h;
|
89
|
-
}
|
90
|
-
|
91
|
-
|
92
|
-
/* Callback from ares when socket operation is started */
|
93
|
-
static void uv__ares_sockstate_cb(void* data, ares_socket_t sock,
|
94
|
-
int read, int write) {
|
95
|
-
uv_loop_t* loop = data;
|
96
|
-
uv_ares_task_t* h;
|
97
|
-
|
98
|
-
assert((uv_loop_t*)loop->timer.data == loop);
|
99
|
-
|
100
|
-
h = uv_find_ares_handle(loop, sock);
|
101
|
-
|
102
|
-
if (read || write) {
|
103
|
-
if (!h) {
|
104
|
-
/* New socket */
|
105
|
-
|
106
|
-
/* If this is the first socket then start the timer. */
|
107
|
-
if (!uv_is_active((uv_handle_t*)&loop->timer)) {
|
108
|
-
assert(uv_ares_handles_empty(loop));
|
109
|
-
uv__ares_timer_start(loop);
|
110
|
-
}
|
111
|
-
|
112
|
-
h = uv__ares_task_create(loop, sock);
|
113
|
-
uv_add_ares_handle(loop, h);
|
114
|
-
}
|
115
|
-
|
116
|
-
if (read) {
|
117
|
-
ev_io_start(loop->ev, &h->read_watcher);
|
118
|
-
} else {
|
119
|
-
ev_io_stop(loop->ev, &h->read_watcher);
|
120
|
-
}
|
121
|
-
|
122
|
-
if (write) {
|
123
|
-
ev_io_start(loop->ev, &h->write_watcher);
|
124
|
-
} else {
|
125
|
-
ev_io_stop(loop->ev, &h->write_watcher);
|
126
|
-
}
|
127
|
-
|
128
|
-
} else {
|
129
|
-
/*
|
130
|
-
* read == 0 and write == 0 this is c-ares's way of notifying us that
|
131
|
-
* the socket is now closed. We must free the data associated with
|
132
|
-
* socket.
|
133
|
-
*/
|
134
|
-
assert(h && "When an ares socket is closed we should have a handle for it");
|
135
|
-
|
136
|
-
ev_io_stop(loop->ev, &h->read_watcher);
|
137
|
-
ev_io_stop(loop->ev, &h->write_watcher);
|
138
|
-
|
139
|
-
uv_remove_ares_handle(h);
|
140
|
-
free(h);
|
141
|
-
|
142
|
-
if (uv_ares_handles_empty(loop)) {
|
143
|
-
uv__ares_timer_stop(loop);
|
144
|
-
}
|
145
|
-
}
|
146
|
-
}
|
147
|
-
|
148
|
-
|
149
|
-
/* c-ares integration initialize and terminate */
|
150
|
-
/* TODO: share this with windows? */
|
151
|
-
int uv_ares_init_options(uv_loop_t* loop, ares_channel *channelptr,
|
152
|
-
struct ares_options *options, int optmask) {
|
153
|
-
int rc;
|
154
|
-
|
155
|
-
/* only allow single init at a time */
|
156
|
-
if (loop->channel != NULL) {
|
157
|
-
uv__set_artificial_error(loop, UV_EALREADY);
|
158
|
-
return -1;
|
159
|
-
}
|
160
|
-
|
161
|
-
/* set our callback as an option */
|
162
|
-
options->sock_state_cb = uv__ares_sockstate_cb;
|
163
|
-
options->sock_state_cb_data = loop;
|
164
|
-
optmask |= ARES_OPT_SOCK_STATE_CB;
|
165
|
-
|
166
|
-
/* We do the call to ares_init_option for caller. */
|
167
|
-
rc = ares_init_options(channelptr, options, optmask);
|
168
|
-
|
169
|
-
/* if success, save channel */
|
170
|
-
if (rc == ARES_SUCCESS) {
|
171
|
-
loop->channel = *channelptr;
|
172
|
-
}
|
173
|
-
|
174
|
-
/*
|
175
|
-
* Initialize the timeout timer. The timer won't be started until the
|
176
|
-
* first socket is opened.
|
177
|
-
*/
|
178
|
-
uv_timer_init(loop, &loop->timer);
|
179
|
-
uv_unref(loop);
|
180
|
-
loop->timer.data = loop;
|
181
|
-
|
182
|
-
return rc;
|
183
|
-
}
|
184
|
-
|
185
|
-
|
186
|
-
/* TODO share this with windows? */
|
187
|
-
void uv_ares_destroy(uv_loop_t* loop, ares_channel channel) {
|
188
|
-
/* only allow destroy if did init */
|
189
|
-
if (loop->channel) {
|
190
|
-
uv__ares_timer_stop(loop);
|
191
|
-
ares_destroy(channel);
|
192
|
-
loop->channel = NULL;
|
193
|
-
}
|
194
|
-
}
|