noderb 0.0.4 → 0.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/ext/noderb_extension/libuv/AUTHORS +11 -1
- data/ext/noderb_extension/libuv/LICENSE +0 -8
- data/ext/noderb_extension/libuv/Makefile +5 -5
- data/ext/noderb_extension/libuv/README +11 -6
- data/ext/noderb_extension/libuv/common.gypi +158 -7
- data/ext/noderb_extension/libuv/config-unix.mk +34 -26
- data/ext/noderb_extension/libuv/gyp_uv +22 -4
- data/ext/noderb_extension/libuv/include/{eio.h → uv-private/eio.h} +2 -2
- data/ext/noderb_extension/libuv/include/{uv-unix.h → uv-private/uv-unix.h} +40 -0
- data/ext/noderb_extension/libuv/include/{uv-win.h → uv-private/uv-win.h} +96 -14
- data/ext/noderb_extension/libuv/include/uv.h +508 -83
- data/ext/noderb_extension/libuv/src/unix/cares.c +185 -0
- data/ext/noderb_extension/libuv/src/unix/core.c +828 -0
- data/ext/noderb_extension/libuv/src/{eio → unix/eio}/config_darwin.h +4 -0
- data/ext/noderb_extension/libuv/src/{eio → unix/eio}/config_linux.h +5 -15
- data/ext/noderb_extension/libuv/src/{eio → unix/eio}/eio.c +23 -2
- data/ext/noderb_extension/libuv/src/unix/error.c +102 -0
- data/ext/noderb_extension/libuv/src/{ev → unix/ev}/config_linux.h +26 -15
- data/ext/noderb_extension/libuv/src/unix/fs.c +562 -0
- data/ext/noderb_extension/libuv/src/unix/internal.h +75 -0
- data/ext/noderb_extension/libuv/src/unix/pipe.c +282 -0
- data/ext/noderb_extension/libuv/src/unix/process.c +287 -0
- data/ext/noderb_extension/libuv/src/unix/stream.c +727 -0
- data/ext/noderb_extension/libuv/src/unix/tcp.c +226 -0
- data/ext/noderb_extension/libuv/src/unix/udp.c +524 -0
- data/ext/noderb_extension/libuv/src/{uv-eio.c → unix/uv-eio.c} +48 -27
- data/ext/noderb_extension/libuv/src/{uv-eio.h → unix/uv-eio.h} +1 -1
- data/ext/noderb_extension/libuv/src/uv-common.c +24 -14
- data/ext/noderb_extension/libuv/src/uv-common.h +12 -7
- data/ext/noderb_extension/libuv/src/win/async.c +14 -16
- data/ext/noderb_extension/libuv/src/win/cares.c +64 -79
- data/ext/noderb_extension/libuv/src/win/core.c +105 -53
- data/ext/noderb_extension/libuv/src/win/error.c +23 -13
- data/ext/noderb_extension/libuv/src/win/fs.c +807 -0
- data/ext/noderb_extension/libuv/src/win/getaddrinfo.c +61 -41
- data/ext/noderb_extension/libuv/src/win/handle.c +56 -30
- data/ext/noderb_extension/libuv/src/win/internal.h +134 -95
- data/ext/noderb_extension/libuv/src/win/loop-watcher.c +21 -18
- data/ext/noderb_extension/libuv/src/win/pipe.c +313 -158
- data/ext/noderb_extension/libuv/src/win/process.c +117 -131
- data/ext/noderb_extension/libuv/src/win/req.c +55 -31
- data/ext/noderb_extension/libuv/src/win/stdio.c +5 -5
- data/ext/noderb_extension/libuv/src/win/stream.c +19 -14
- data/ext/noderb_extension/libuv/src/win/tcp.c +278 -336
- data/ext/noderb_extension/libuv/src/win/threadpool.c +73 -0
- data/ext/noderb_extension/libuv/src/win/timer.c +44 -37
- data/ext/noderb_extension/libuv/src/win/udp.c +592 -0
- data/ext/noderb_extension/libuv/src/win/util.c +20 -6
- data/ext/noderb_extension/libuv/src/win/winapi.c +23 -6
- data/ext/noderb_extension/libuv/src/win/winapi.h +4206 -0
- data/ext/noderb_extension/libuv/src/win/winsock.c +270 -0
- data/ext/noderb_extension/libuv/src/win/winsock.h +134 -0
- data/ext/noderb_extension/libuv/test/benchmark-ares.c +10 -6
- data/ext/noderb_extension/libuv/test/benchmark-getaddrinfo.c +10 -7
- data/ext/noderb_extension/libuv/test/benchmark-list.h +21 -0
- data/ext/noderb_extension/libuv/test/benchmark-ping-pongs.c +11 -7
- data/ext/noderb_extension/libuv/test/benchmark-pound.c +147 -58
- data/ext/noderb_extension/libuv/test/benchmark-pump.c +29 -23
- data/ext/noderb_extension/libuv/test/benchmark-spawn.c +13 -10
- data/ext/noderb_extension/libuv/test/benchmark-udp-packet-storm.c +250 -0
- data/ext/noderb_extension/libuv/test/dns-server.c +11 -6
- data/ext/noderb_extension/libuv/test/echo-server.c +30 -22
- data/ext/noderb_extension/libuv/test/test-async.c +3 -3
- data/ext/noderb_extension/libuv/test/test-callback-stack.c +6 -6
- data/ext/noderb_extension/libuv/test/test-connection-fail.c +6 -5
- data/ext/noderb_extension/libuv/test/test-delayed-accept.c +13 -13
- data/ext/noderb_extension/libuv/test/test-fs.c +715 -0
- data/ext/noderb_extension/libuv/test/test-getaddrinfo.c +11 -8
- data/ext/noderb_extension/libuv/test/test-gethostbyname.c +8 -9
- data/ext/noderb_extension/libuv/test/test-getsockname.c +142 -16
- data/ext/noderb_extension/libuv/test/test-idle.c +4 -3
- data/ext/noderb_extension/libuv/test/test-list.h +29 -2
- data/ext/noderb_extension/libuv/test/test-loop-handles.c +9 -8
- data/ext/noderb_extension/libuv/test/test-ping-pong.c +9 -9
- data/ext/noderb_extension/libuv/test/test-pipe-bind-error.c +18 -14
- data/ext/noderb_extension/libuv/test/test-ref.c +17 -16
- data/ext/noderb_extension/libuv/test/test-shutdown-eof.c +5 -5
- data/ext/noderb_extension/libuv/test/test-spawn.c +17 -17
- data/ext/noderb_extension/libuv/test/test-tcp-bind-error.c +24 -18
- data/ext/noderb_extension/libuv/test/test-tcp-bind6-error.c +19 -14
- data/ext/noderb_extension/libuv/test/test-tcp-writealot.c +6 -5
- data/ext/noderb_extension/libuv/test/test-threadpool.c +59 -0
- data/ext/noderb_extension/libuv/test/test-timer-again.c +15 -12
- data/ext/noderb_extension/libuv/test/test-timer.c +8 -8
- data/ext/noderb_extension/libuv/test/test-udp-dgram-too-big.c +88 -0
- data/ext/noderb_extension/libuv/test/test-udp-ipv6.c +158 -0
- data/ext/noderb_extension/libuv/test/test-udp-send-and-recv.c +210 -0
- data/ext/noderb_extension/libuv/{all.gyp → uv.gyp} +75 -77
- data/ext/noderb_extension/libuv/vcbuild.bat +93 -0
- data/ext/noderb_extension/noderb.c +13 -0
- data/ext/noderb_extension/noderb_common.h +2 -1
- data/ext/noderb_extension/noderb_defer.c +54 -0
- data/ext/noderb_extension/noderb_defer.h +15 -0
- data/ext/noderb_extension/noderb_dns.c +1 -1
- data/ext/noderb_extension/noderb_fs.c +277 -0
- data/ext/noderb_extension/noderb_fs.h +27 -0
- data/ext/noderb_extension/noderb_process.c +5 -5
- data/ext/noderb_extension/noderb_tcp.c +10 -6
- data/ext/noderb_extension/noderb_timers.c +1 -1
- data/ext/noderb_extension/noderb_tools.c +42 -8
- data/ext/noderb_extension/noderb_tools.h +3 -1
- data/lib/noderb/defer.rb +25 -0
- data/lib/noderb/file.rb +119 -0
- data/lib/noderb/fs.rb +72 -0
- data/lib/noderb/version.rb +1 -1
- data/lib/noderb.rb +8 -0
- metadata +102 -266
- data/ext/noderb_extension/libuv/BSDmakefile +0 -2
- data/ext/noderb_extension/libuv/create-msvs-files.bat +0 -21
- data/ext/noderb_extension/libuv/deps/pthread-win32/ANNOUNCE +0 -482
- data/ext/noderb_extension/libuv/deps/pthread-win32/BUGS +0 -141
- data/ext/noderb_extension/libuv/deps/pthread-win32/Bmakefile +0 -268
- data/ext/noderb_extension/libuv/deps/pthread-win32/CONTRIBUTORS +0 -140
- data/ext/noderb_extension/libuv/deps/pthread-win32/COPYING +0 -150
- data/ext/noderb_extension/libuv/deps/pthread-win32/COPYING.LIB +0 -504
- data/ext/noderb_extension/libuv/deps/pthread-win32/ChangeLog +0 -5194
- data/ext/noderb_extension/libuv/deps/pthread-win32/FAQ +0 -451
- data/ext/noderb_extension/libuv/deps/pthread-win32/GNUmakefile +0 -593
- data/ext/noderb_extension/libuv/deps/pthread-win32/MAINTAINERS +0 -4
- data/ext/noderb_extension/libuv/deps/pthread-win32/Makefile +0 -516
- data/ext/noderb_extension/libuv/deps/pthread-win32/NEWS +0 -1245
- data/ext/noderb_extension/libuv/deps/pthread-win32/Nmakefile +0 -24
- data/ext/noderb_extension/libuv/deps/pthread-win32/Nmakefile.tests +0 -260
- data/ext/noderb_extension/libuv/deps/pthread-win32/PROGRESS +0 -4
- data/ext/noderb_extension/libuv/deps/pthread-win32/README +0 -601
- data/ext/noderb_extension/libuv/deps/pthread-win32/README.Borland +0 -57
- data/ext/noderb_extension/libuv/deps/pthread-win32/README.CV +0 -3036
- data/ext/noderb_extension/libuv/deps/pthread-win32/README.NONPORTABLE +0 -783
- data/ext/noderb_extension/libuv/deps/pthread-win32/README.Watcom +0 -62
- data/ext/noderb_extension/libuv/deps/pthread-win32/README.WinCE +0 -6
- data/ext/noderb_extension/libuv/deps/pthread-win32/TODO +0 -7
- data/ext/noderb_extension/libuv/deps/pthread-win32/WinCE-PORT +0 -222
- data/ext/noderb_extension/libuv/deps/pthread-win32/attr.c +0 -53
- data/ext/noderb_extension/libuv/deps/pthread-win32/autostatic.c +0 -69
- data/ext/noderb_extension/libuv/deps/pthread-win32/barrier.c +0 -47
- data/ext/noderb_extension/libuv/deps/pthread-win32/build/all.gyp +0 -207
- data/ext/noderb_extension/libuv/deps/pthread-win32/builddmc.bat +0 -9
- data/ext/noderb_extension/libuv/deps/pthread-win32/cancel.c +0 -44
- data/ext/noderb_extension/libuv/deps/pthread-win32/cleanup.c +0 -148
- data/ext/noderb_extension/libuv/deps/pthread-win32/condvar.c +0 -50
- data/ext/noderb_extension/libuv/deps/pthread-win32/config.h +0 -153
- data/ext/noderb_extension/libuv/deps/pthread-win32/context.h +0 -74
- data/ext/noderb_extension/libuv/deps/pthread-win32/create.c +0 -308
- data/ext/noderb_extension/libuv/deps/pthread-win32/dll.c +0 -92
- data/ext/noderb_extension/libuv/deps/pthread-win32/errno.c +0 -94
- data/ext/noderb_extension/libuv/deps/pthread-win32/exit.c +0 -44
- data/ext/noderb_extension/libuv/deps/pthread-win32/fork.c +0 -39
- data/ext/noderb_extension/libuv/deps/pthread-win32/global.c +0 -107
- data/ext/noderb_extension/libuv/deps/pthread-win32/implement.h +0 -944
- data/ext/noderb_extension/libuv/deps/pthread-win32/misc.c +0 -50
- data/ext/noderb_extension/libuv/deps/pthread-win32/mutex.c +0 -62
- data/ext/noderb_extension/libuv/deps/pthread-win32/need_errno.h +0 -145
- data/ext/noderb_extension/libuv/deps/pthread-win32/nonportable.c +0 -47
- data/ext/noderb_extension/libuv/deps/pthread-win32/private.c +0 -54
- data/ext/noderb_extension/libuv/deps/pthread-win32/pthread.c +0 -66
- data/ext/noderb_extension/libuv/deps/pthread-win32/pthread.dsp +0 -142
- data/ext/noderb_extension/libuv/deps/pthread-win32/pthread.dsw +0 -29
- data/ext/noderb_extension/libuv/deps/pthread-win32/pthread.h +0 -1368
- data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_attr_destroy.c +0 -79
- data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_attr_getdetachstate.c +0 -86
- data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_attr_getinheritsched.c +0 -51
- data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_attr_getschedparam.c +0 -52
- data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_attr_getschedpolicy.c +0 -61
- data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_attr_getscope.c +0 -54
- data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_attr_getstackaddr.c +0 -97
- data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_attr_getstacksize.c +0 -100
- data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_attr_init.c +0 -117
- data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_attr_setdetachstate.c +0 -91
- data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_attr_setinheritsched.c +0 -57
- data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_attr_setschedparam.c +0 -63
- data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_attr_setschedpolicy.c +0 -55
- data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_attr_setscope.c +0 -62
- data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_attr_setstackaddr.c +0 -97
- data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_attr_setstacksize.c +0 -110
- data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_barrier_destroy.c +0 -103
- data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_barrier_init.c +0 -69
- data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_barrier_wait.c +0 -104
- data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_barrierattr_destroy.c +0 -83
- data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_barrierattr_getpshared.c +0 -95
- data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_barrierattr_init.c +0 -85
- data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_barrierattr_setpshared.c +0 -119
- data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_cancel.c +0 -189
- data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_cond_destroy.c +0 -253
- data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_cond_init.c +0 -167
- data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_cond_signal.c +0 -231
- data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_cond_wait.c +0 -567
- data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_condattr_destroy.c +0 -86
- data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_condattr_getpshared.c +0 -97
- data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_condattr_init.c +0 -87
- data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_condattr_setpshared.c +0 -117
- data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_delay_np.c +0 -172
- data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_detach.c +0 -136
- data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_equal.c +0 -76
- data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_exit.c +0 -106
- data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_getconcurrency.c +0 -45
- data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_getschedparam.c +0 -75
- data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_getspecific.c +0 -87
- data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_getunique_np.c +0 -47
- data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_getw32threadhandle_np.c +0 -65
- data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_join.c +0 -157
- data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_key_create.c +0 -108
- data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_key_delete.c +0 -125
- data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_kill.c +0 -105
- data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_mutex_consistent.c +0 -187
- data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_mutex_destroy.c +0 -148
- data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_mutex_init.c +0 -130
- data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_mutex_lock.c +0 -269
- data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_mutex_timedlock.c +0 -324
- data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_mutex_trylock.c +0 -154
- data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_mutex_unlock.c +0 -175
- data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_mutexattr_destroy.c +0 -83
- data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_mutexattr_getkind_np.c +0 -44
- data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_mutexattr_getpshared.c +0 -95
- data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_mutexattr_getrobust.c +0 -113
- data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_mutexattr_gettype.c +0 -56
- data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_mutexattr_init.c +0 -86
- data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_mutexattr_setkind_np.c +0 -44
- data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_mutexattr_setpshared.c +0 -119
- data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_mutexattr_setrobust.c +0 -119
- data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_mutexattr_settype.c +0 -143
- data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_num_processors_np.c +0 -56
- data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_once.c +0 -79
- data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_rwlock_destroy.c +0 -143
- data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_rwlock_init.c +0 -109
- data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_rwlock_rdlock.c +0 -102
- data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_rwlock_timedrdlock.c +0 -109
- data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_rwlock_timedwrlock.c +0 -139
- data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_rwlock_tryrdlock.c +0 -102
- data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_rwlock_trywrlock.c +0 -122
- data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_rwlock_unlock.c +0 -93
- data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_rwlock_wrlock.c +0 -133
- data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_rwlockattr_destroy.c +0 -84
- data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_rwlockattr_getpshared.c +0 -97
- data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_rwlockattr_init.c +0 -83
- data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_rwlockattr_setpshared.c +0 -120
- data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_self.c +0 -141
- data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_setcancelstate.c +0 -125
- data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_setcanceltype.c +0 -126
- data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_setconcurrency.c +0 -53
- data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_setschedparam.c +0 -123
- data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_setspecific.c +0 -167
- data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_spin_destroy.c +0 -111
- data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_spin_init.c +0 -123
- data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_spin_lock.c +0 -80
- data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_spin_trylock.c +0 -77
- data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_spin_unlock.c +0 -71
- data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_testcancel.c +0 -103
- data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_timechange_handler_np.c +0 -108
- data/ext/noderb_extension/libuv/deps/pthread-win32/pthread_win32_attach_detach_np.c +0 -258
- data/ext/noderb_extension/libuv/deps/pthread-win32/ptw32_MCS_lock.c +0 -278
- data/ext/noderb_extension/libuv/deps/pthread-win32/ptw32_callUserDestroyRoutines.c +0 -232
- data/ext/noderb_extension/libuv/deps/pthread-win32/ptw32_calloc.c +0 -56
- data/ext/noderb_extension/libuv/deps/pthread-win32/ptw32_cond_check_need_init.c +0 -78
- data/ext/noderb_extension/libuv/deps/pthread-win32/ptw32_getprocessors.c +0 -91
- data/ext/noderb_extension/libuv/deps/pthread-win32/ptw32_is_attr.c +0 -47
- data/ext/noderb_extension/libuv/deps/pthread-win32/ptw32_mutex_check_need_init.c +0 -92
- data/ext/noderb_extension/libuv/deps/pthread-win32/ptw32_new.c +0 -94
- data/ext/noderb_extension/libuv/deps/pthread-win32/ptw32_processInitialize.c +0 -92
- data/ext/noderb_extension/libuv/deps/pthread-win32/ptw32_processTerminate.c +0 -105
- data/ext/noderb_extension/libuv/deps/pthread-win32/ptw32_relmillisecs.c +0 -132
- data/ext/noderb_extension/libuv/deps/pthread-win32/ptw32_reuse.c +0 -151
- data/ext/noderb_extension/libuv/deps/pthread-win32/ptw32_rwlock_cancelwrwait.c +0 -50
- data/ext/noderb_extension/libuv/deps/pthread-win32/ptw32_rwlock_check_need_init.c +0 -77
- data/ext/noderb_extension/libuv/deps/pthread-win32/ptw32_semwait.c +0 -135
- data/ext/noderb_extension/libuv/deps/pthread-win32/ptw32_spinlock_check_need_init.c +0 -78
- data/ext/noderb_extension/libuv/deps/pthread-win32/ptw32_threadDestroy.c +0 -79
- data/ext/noderb_extension/libuv/deps/pthread-win32/ptw32_threadStart.c +0 -357
- data/ext/noderb_extension/libuv/deps/pthread-win32/ptw32_throw.c +0 -189
- data/ext/noderb_extension/libuv/deps/pthread-win32/ptw32_timespec.c +0 -83
- data/ext/noderb_extension/libuv/deps/pthread-win32/ptw32_tkAssocCreate.c +0 -118
- data/ext/noderb_extension/libuv/deps/pthread-win32/ptw32_tkAssocDestroy.c +0 -114
- data/ext/noderb_extension/libuv/deps/pthread-win32/rwlock.c +0 -51
- data/ext/noderb_extension/libuv/deps/pthread-win32/sched.c +0 -53
- data/ext/noderb_extension/libuv/deps/pthread-win32/sched.h +0 -183
- data/ext/noderb_extension/libuv/deps/pthread-win32/sched_get_priority_max.c +0 -134
- data/ext/noderb_extension/libuv/deps/pthread-win32/sched_get_priority_min.c +0 -135
- data/ext/noderb_extension/libuv/deps/pthread-win32/sched_getscheduler.c +0 -71
- data/ext/noderb_extension/libuv/deps/pthread-win32/sched_setscheduler.c +0 -83
- data/ext/noderb_extension/libuv/deps/pthread-win32/sched_yield.c +0 -71
- data/ext/noderb_extension/libuv/deps/pthread-win32/sem_close.c +0 -58
- data/ext/noderb_extension/libuv/deps/pthread-win32/sem_destroy.c +0 -144
- data/ext/noderb_extension/libuv/deps/pthread-win32/sem_getvalue.c +0 -110
- data/ext/noderb_extension/libuv/deps/pthread-win32/sem_init.c +0 -169
- data/ext/noderb_extension/libuv/deps/pthread-win32/sem_open.c +0 -58
- data/ext/noderb_extension/libuv/deps/pthread-win32/sem_post.c +0 -128
- data/ext/noderb_extension/libuv/deps/pthread-win32/sem_post_multiple.c +0 -142
- data/ext/noderb_extension/libuv/deps/pthread-win32/sem_timedwait.c +0 -238
- data/ext/noderb_extension/libuv/deps/pthread-win32/sem_trywait.c +0 -117
- data/ext/noderb_extension/libuv/deps/pthread-win32/sem_unlink.c +0 -58
- data/ext/noderb_extension/libuv/deps/pthread-win32/sem_wait.c +0 -187
- data/ext/noderb_extension/libuv/deps/pthread-win32/semaphore.c +0 -69
- data/ext/noderb_extension/libuv/deps/pthread-win32/semaphore.h +0 -169
- data/ext/noderb_extension/libuv/deps/pthread-win32/signal.c +0 -179
- data/ext/noderb_extension/libuv/deps/pthread-win32/spin.c +0 -46
- data/ext/noderb_extension/libuv/deps/pthread-win32/sync.c +0 -43
- data/ext/noderb_extension/libuv/deps/pthread-win32/tsd.c +0 -44
- data/ext/noderb_extension/libuv/deps/pthread-win32/version.rc +0 -388
- data/ext/noderb_extension/libuv/deps/pthread-win32/w32_CancelableWait.c +0 -161
- data/ext/noderb_extension/libuv/doc/iocp-links.html +0 -574
- data/ext/noderb_extension/libuv/src/uv-unix.c +0 -2421
- data/ext/noderb_extension/libuv/src/win/ntdll.h +0 -130
- /data/ext/noderb_extension/libuv/include/{ev.h → uv-private/ev.h} +0 -0
- /data/ext/noderb_extension/libuv/include/{ngx-queue.h → uv-private/ngx-queue.h} +0 -0
- /data/ext/noderb_extension/libuv/include/{tree.h → uv-private/tree.h} +0 -0
- /data/ext/noderb_extension/libuv/src/{uv-cygwin.c → unix/cygwin.c} +0 -0
- /data/ext/noderb_extension/libuv/src/{uv-darwin.c → unix/darwin.c} +0 -0
- /data/ext/noderb_extension/libuv/src/{eio → unix/eio}/Changes +0 -0
- /data/ext/noderb_extension/libuv/src/{eio → unix/eio}/LICENSE +0 -0
- /data/ext/noderb_extension/libuv/src/{eio → unix/eio}/Makefile.am +0 -0
- /data/ext/noderb_extension/libuv/src/{eio → unix/eio}/aclocal.m4 +0 -0
- /data/ext/noderb_extension/libuv/src/{eio → unix/eio}/autogen.sh +0 -0
- /data/ext/noderb_extension/libuv/src/{eio → unix/eio}/config.h.in +0 -0
- /data/ext/noderb_extension/libuv/src/{eio → unix/eio}/config_cygwin.h +0 -0
- /data/ext/noderb_extension/libuv/src/{eio → unix/eio}/config_freebsd.h +0 -0
- /data/ext/noderb_extension/libuv/src/{eio → unix/eio}/config_sunos.h +0 -0
- /data/ext/noderb_extension/libuv/src/{eio → unix/eio}/configure.ac +0 -0
- /data/ext/noderb_extension/libuv/src/{eio → unix/eio}/demo.c +0 -0
- /data/ext/noderb_extension/libuv/src/{eio → unix/eio}/ecb.h +0 -0
- /data/ext/noderb_extension/libuv/src/{eio → unix/eio}/eio.3 +0 -0
- /data/ext/noderb_extension/libuv/src/{eio → unix/eio}/eio.pod +0 -0
- /data/ext/noderb_extension/libuv/src/{eio → unix/eio}/libeio.m4 +0 -0
- /data/ext/noderb_extension/libuv/src/{eio → unix/eio}/xthread.h +0 -0
- /data/ext/noderb_extension/libuv/src/{ev → unix/ev}/Changes +0 -0
- /data/ext/noderb_extension/libuv/src/{ev → unix/ev}/LICENSE +0 -0
- /data/ext/noderb_extension/libuv/src/{ev → unix/ev}/Makefile.am +0 -0
- /data/ext/noderb_extension/libuv/src/{ev → unix/ev}/Makefile.in +0 -0
- /data/ext/noderb_extension/libuv/src/{ev → unix/ev}/README +0 -0
- /data/ext/noderb_extension/libuv/src/{ev → unix/ev}/aclocal.m4 +0 -0
- /data/ext/noderb_extension/libuv/src/{ev → unix/ev}/autogen.sh +0 -0
- /data/ext/noderb_extension/libuv/src/{ev → unix/ev}/config.guess +0 -0
- /data/ext/noderb_extension/libuv/src/{ev → unix/ev}/config.h.in +0 -0
- /data/ext/noderb_extension/libuv/src/{ev → unix/ev}/config.sub +0 -0
- /data/ext/noderb_extension/libuv/src/{ev → unix/ev}/config_cygwin.h +0 -0
- /data/ext/noderb_extension/libuv/src/{ev → unix/ev}/config_darwin.h +0 -0
- /data/ext/noderb_extension/libuv/src/{ev → unix/ev}/config_freebsd.h +0 -0
- /data/ext/noderb_extension/libuv/src/{ev → unix/ev}/config_sunos.h +0 -0
- /data/ext/noderb_extension/libuv/src/{ev → unix/ev}/configure +0 -0
- /data/ext/noderb_extension/libuv/src/{ev → unix/ev}/configure.ac +0 -0
- /data/ext/noderb_extension/libuv/src/{ev → unix/ev}/depcomp +0 -0
- /data/ext/noderb_extension/libuv/src/{ev → unix/ev}/ev++.h +0 -0
- /data/ext/noderb_extension/libuv/src/{ev → unix/ev}/ev.3 +0 -0
- /data/ext/noderb_extension/libuv/src/{ev → unix/ev}/ev.c +0 -0
- /data/ext/noderb_extension/libuv/src/{ev → unix/ev}/ev.pod +0 -0
- /data/ext/noderb_extension/libuv/src/{ev → unix/ev}/ev_epoll.c +0 -0
- /data/ext/noderb_extension/libuv/src/{ev → unix/ev}/ev_kqueue.c +0 -0
- /data/ext/noderb_extension/libuv/src/{ev → unix/ev}/ev_poll.c +0 -0
- /data/ext/noderb_extension/libuv/src/{ev → unix/ev}/ev_port.c +0 -0
- /data/ext/noderb_extension/libuv/src/{ev → unix/ev}/ev_select.c +0 -0
- /data/ext/noderb_extension/libuv/src/{ev → unix/ev}/ev_vars.h +0 -0
- /data/ext/noderb_extension/libuv/src/{ev → unix/ev}/ev_win32.c +0 -0
- /data/ext/noderb_extension/libuv/src/{ev → unix/ev}/ev_wrap.h +0 -0
- /data/ext/noderb_extension/libuv/src/{ev → unix/ev}/event.c +0 -0
- /data/ext/noderb_extension/libuv/src/{ev → unix/ev}/event.h +0 -0
- /data/ext/noderb_extension/libuv/src/{ev → unix/ev}/install-sh +0 -0
- /data/ext/noderb_extension/libuv/src/{ev → unix/ev}/libev.m4 +0 -0
- /data/ext/noderb_extension/libuv/src/{ev → unix/ev}/ltmain.sh +0 -0
- /data/ext/noderb_extension/libuv/src/{ev → unix/ev}/missing +0 -0
- /data/ext/noderb_extension/libuv/src/{ev → unix/ev}/mkinstalldirs +0 -0
- /data/ext/noderb_extension/libuv/src/{uv-freebsd.c → unix/freebsd.c} +0 -0
- /data/ext/noderb_extension/libuv/src/{uv-linux.c → unix/linux.c} +0 -0
- /data/ext/noderb_extension/libuv/src/{uv-sunos.c → unix/sunos.c} +0 -0
|
@@ -31,9 +31,6 @@
|
|
|
31
31
|
#include "ares/inet_net_pton.h"
|
|
32
32
|
#include "ares/inet_ntop.h"
|
|
33
33
|
|
|
34
|
-
/* list used for ares task handles */
|
|
35
|
-
static uv_ares_task_t* uv_ares_handles_ = NULL;
|
|
36
|
-
|
|
37
34
|
|
|
38
35
|
static uv_counters_t counters;
|
|
39
36
|
|
|
@@ -43,6 +40,14 @@ uv_counters_t* uv_counters() {
|
|
|
43
40
|
}
|
|
44
41
|
|
|
45
42
|
|
|
43
|
+
uv_buf_t uv_buf_init(char* base, size_t len) {
|
|
44
|
+
uv_buf_t buf;
|
|
45
|
+
buf.base = base;
|
|
46
|
+
buf.len = len;
|
|
47
|
+
return buf;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
|
|
46
51
|
const char* uv_err_name(uv_err_t err) {
|
|
47
52
|
switch (err.code) {
|
|
48
53
|
case UV_UNKNOWN: return "UNKNOWN";
|
|
@@ -127,20 +132,23 @@ int uv_ip6_name(struct sockaddr_in6* src, char* dst, size_t size) {
|
|
|
127
132
|
|
|
128
133
|
|
|
129
134
|
/* find matching ares handle in list */
|
|
130
|
-
void uv_add_ares_handle(uv_ares_task_t* handle) {
|
|
131
|
-
handle->
|
|
135
|
+
void uv_add_ares_handle(uv_loop_t* loop, uv_ares_task_t* handle) {
|
|
136
|
+
handle->loop = loop;
|
|
137
|
+
handle->ares_next = loop->uv_ares_handles_;
|
|
132
138
|
handle->ares_prev = NULL;
|
|
133
139
|
|
|
134
|
-
if (uv_ares_handles_) {
|
|
135
|
-
uv_ares_handles_->ares_prev = handle;
|
|
140
|
+
if (loop->uv_ares_handles_) {
|
|
141
|
+
loop->uv_ares_handles_->ares_prev = handle;
|
|
136
142
|
}
|
|
137
|
-
|
|
143
|
+
|
|
144
|
+
loop->uv_ares_handles_ = handle;
|
|
138
145
|
}
|
|
139
146
|
|
|
140
147
|
/* find matching ares handle in list */
|
|
141
148
|
/* TODO: faster lookup */
|
|
142
|
-
uv_ares_task_t* uv_find_ares_handle(ares_socket_t sock) {
|
|
143
|
-
uv_ares_task_t* handle = uv_ares_handles_;
|
|
149
|
+
uv_ares_task_t* uv_find_ares_handle(uv_loop_t* loop, ares_socket_t sock) {
|
|
150
|
+
uv_ares_task_t* handle = loop->uv_ares_handles_;
|
|
151
|
+
|
|
144
152
|
while (handle != NULL) {
|
|
145
153
|
if (handle->sock == sock) {
|
|
146
154
|
break;
|
|
@@ -153,8 +161,10 @@ uv_ares_task_t* uv_find_ares_handle(ares_socket_t sock) {
|
|
|
153
161
|
|
|
154
162
|
/* remove ares handle in list */
|
|
155
163
|
void uv_remove_ares_handle(uv_ares_task_t* handle) {
|
|
156
|
-
|
|
157
|
-
|
|
164
|
+
uv_loop_t* loop = handle->loop;
|
|
165
|
+
|
|
166
|
+
if (handle == loop->uv_ares_handles_) {
|
|
167
|
+
loop->uv_ares_handles_ = handle->ares_next;
|
|
158
168
|
}
|
|
159
169
|
|
|
160
170
|
if (handle->ares_next) {
|
|
@@ -168,6 +178,6 @@ void uv_remove_ares_handle(uv_ares_task_t* handle) {
|
|
|
168
178
|
|
|
169
179
|
|
|
170
180
|
/* Returns 1 if the uv_ares_handles_ list is empty. 0 otherwise. */
|
|
171
|
-
int uv_ares_handles_empty() {
|
|
172
|
-
return uv_ares_handles_ ? 0 : 1;
|
|
181
|
+
int uv_ares_handles_empty(uv_loop_t* loop) {
|
|
182
|
+
return loop->uv_ares_handles_ ? 0 : 1;
|
|
173
183
|
}
|
|
@@ -31,10 +31,12 @@
|
|
|
31
31
|
|
|
32
32
|
#define COUNTOF(a) (sizeof(a) / sizeof(a[0]))
|
|
33
33
|
|
|
34
|
-
/*
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
34
|
+
/* Used for the uv_fs_ functions */
|
|
35
|
+
#define SET_REQ_RESULT(req, result) \
|
|
36
|
+
req->result = result; \
|
|
37
|
+
if (result == -1) { \
|
|
38
|
+
req->errorno = errno; \
|
|
39
|
+
}
|
|
38
40
|
|
|
39
41
|
struct uv_ares_task_s {
|
|
40
42
|
UV_HANDLE_FIELDS
|
|
@@ -45,9 +47,12 @@ struct uv_ares_task_s {
|
|
|
45
47
|
|
|
46
48
|
|
|
47
49
|
void uv_remove_ares_handle(uv_ares_task_t* handle);
|
|
48
|
-
uv_ares_task_t* uv_find_ares_handle(ares_socket_t sock);
|
|
49
|
-
|
|
50
|
-
|
|
50
|
+
uv_ares_task_t* uv_find_ares_handle(uv_loop_t*, ares_socket_t sock);
|
|
51
|
+
|
|
52
|
+
/* TODO Rename to uv_ares_task_init? */
|
|
53
|
+
void uv_add_ares_handle(uv_loop_t* loop, uv_ares_task_t* handle);
|
|
54
|
+
|
|
55
|
+
int uv_ares_handles_empty(uv_loop_t* loop);
|
|
51
56
|
|
|
52
57
|
|
|
53
58
|
#endif /* UV_COMMON_H_ */
|
|
@@ -54,7 +54,7 @@ static inline char uv_atomic_exchange_set(char volatile* target) {
|
|
|
54
54
|
#endif
|
|
55
55
|
|
|
56
56
|
|
|
57
|
-
void uv_async_endgame(uv_async_t* handle) {
|
|
57
|
+
void uv_async_endgame(uv_loop_t* loop, uv_async_t* handle) {
|
|
58
58
|
if (handle->flags & UV_HANDLE_CLOSING &&
|
|
59
59
|
!handle->async_sent) {
|
|
60
60
|
assert(!(handle->flags & UV_HANDLE_CLOSED));
|
|
@@ -64,35 +64,37 @@ void uv_async_endgame(uv_async_t* handle) {
|
|
|
64
64
|
handle->close_cb((uv_handle_t*)handle);
|
|
65
65
|
}
|
|
66
66
|
|
|
67
|
-
uv_unref();
|
|
67
|
+
uv_unref(loop);
|
|
68
68
|
}
|
|
69
69
|
}
|
|
70
70
|
|
|
71
71
|
|
|
72
|
-
int uv_async_init(uv_async_t* handle, uv_async_cb async_cb) {
|
|
72
|
+
int uv_async_init(uv_loop_t* loop, uv_async_t* handle, uv_async_cb async_cb) {
|
|
73
73
|
uv_req_t* req;
|
|
74
74
|
|
|
75
|
-
|
|
76
|
-
|
|
75
|
+
loop->counters.handle_init++;
|
|
76
|
+
loop->counters.async_init++;
|
|
77
77
|
|
|
78
78
|
handle->type = UV_ASYNC;
|
|
79
|
+
handle->loop = loop;
|
|
79
80
|
handle->flags = 0;
|
|
80
81
|
handle->async_sent = 0;
|
|
81
|
-
handle->error = uv_ok_;
|
|
82
82
|
handle->async_cb = async_cb;
|
|
83
83
|
|
|
84
84
|
req = &handle->async_req;
|
|
85
|
-
uv_req_init(req);
|
|
85
|
+
uv_req_init(loop, req);
|
|
86
86
|
req->type = UV_WAKEUP;
|
|
87
87
|
req->data = handle;
|
|
88
88
|
|
|
89
|
-
uv_ref();
|
|
89
|
+
uv_ref(loop);
|
|
90
90
|
|
|
91
91
|
return 0;
|
|
92
92
|
}
|
|
93
93
|
|
|
94
94
|
|
|
95
95
|
int uv_async_send(uv_async_t* handle) {
|
|
96
|
+
uv_loop_t* loop = handle->loop;
|
|
97
|
+
|
|
96
98
|
if (handle->type != UV_ASYNC) {
|
|
97
99
|
/* Can't set errno because that's not thread-safe. */
|
|
98
100
|
return -1;
|
|
@@ -103,19 +105,15 @@ int uv_async_send(uv_async_t* handle) {
|
|
|
103
105
|
assert(!(handle->flags & UV_HANDLE_CLOSING));
|
|
104
106
|
|
|
105
107
|
if (!uv_atomic_exchange_set(&handle->async_sent)) {
|
|
106
|
-
|
|
107
|
-
0,
|
|
108
|
-
0,
|
|
109
|
-
&handle->async_req.overlapped)) {
|
|
110
|
-
uv_fatal_error(GetLastError(), "PostQueuedCompletionStatus");
|
|
111
|
-
}
|
|
108
|
+
POST_COMPLETION_FOR_REQ(loop, &handle->async_req);
|
|
112
109
|
}
|
|
113
110
|
|
|
114
111
|
return 0;
|
|
115
112
|
}
|
|
116
113
|
|
|
117
114
|
|
|
118
|
-
void uv_process_async_wakeup_req(
|
|
115
|
+
void uv_process_async_wakeup_req(uv_loop_t* loop, uv_async_t* handle,
|
|
116
|
+
uv_req_t* req) {
|
|
119
117
|
assert(handle->type == UV_ASYNC);
|
|
120
118
|
assert(req->type == UV_WAKEUP);
|
|
121
119
|
|
|
@@ -124,6 +122,6 @@ void uv_process_async_wakeup_req(uv_async_t* handle, uv_req_t* req) {
|
|
|
124
122
|
handle->async_cb((uv_async_t*) handle, 0);
|
|
125
123
|
}
|
|
126
124
|
if (handle->flags & UV_HANDLE_CLOSING) {
|
|
127
|
-
uv_want_endgame((uv_handle_t*)handle);
|
|
125
|
+
uv_want_endgame(loop, (uv_handle_t*)handle);
|
|
128
126
|
}
|
|
129
127
|
}
|
|
@@ -38,41 +38,34 @@ struct uv_ares_action_s {
|
|
|
38
38
|
};
|
|
39
39
|
|
|
40
40
|
|
|
41
|
-
/* memory used per ares_channel */
|
|
42
|
-
typedef struct uv_ares_channel_s {
|
|
43
|
-
ares_channel channel;
|
|
44
|
-
int activesockets;
|
|
45
|
-
uv_timer_t pollingtimer;
|
|
46
|
-
} uv_ares_channel_t;
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
/* static data to hold single ares_channel */
|
|
50
|
-
static uv_ares_channel_t uv_ares_data = { NULL, 0 };
|
|
51
|
-
|
|
52
|
-
|
|
53
41
|
/* default timeout per socket request if ares does not specify value */
|
|
54
42
|
/* use 20 sec */
|
|
55
43
|
#define ARES_TIMEOUT_MS 20000
|
|
56
44
|
|
|
57
45
|
|
|
58
46
|
/* thread pool callback when socket is signalled */
|
|
59
|
-
static void CALLBACK uv_ares_socksignal_tp(void* parameter,
|
|
47
|
+
static void CALLBACK uv_ares_socksignal_tp(void* parameter,
|
|
48
|
+
BOOLEAN timerfired) {
|
|
60
49
|
WSANETWORKEVENTS network_events;
|
|
61
50
|
uv_ares_task_t* sockhandle;
|
|
62
51
|
uv_ares_action_t* selhandle;
|
|
63
52
|
uv_req_t* uv_ares_req;
|
|
53
|
+
uv_loop_t* loop;
|
|
64
54
|
|
|
65
55
|
assert(parameter != NULL);
|
|
66
56
|
|
|
67
57
|
if (parameter != NULL) {
|
|
68
|
-
sockhandle = (uv_ares_task_t*)parameter;
|
|
58
|
+
sockhandle = (uv_ares_task_t*) parameter;
|
|
59
|
+
loop = sockhandle->loop;
|
|
69
60
|
|
|
70
61
|
/* clear socket status for this event */
|
|
71
62
|
/* do not fail if error, thread may run after socket close */
|
|
72
|
-
/* The code assumes that c-ares will write all pending data in the
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
WSAEnumNetworkEvents(sockhandle->sock,
|
|
63
|
+
/* The code assumes that c-ares will write all pending data in the */
|
|
64
|
+
/* callback, unless the socket would block. We can clear the state here */
|
|
65
|
+
/* to avoid unecessary signals. */
|
|
66
|
+
WSAEnumNetworkEvents(sockhandle->sock,
|
|
67
|
+
sockhandle->h_event,
|
|
68
|
+
&network_events);
|
|
76
69
|
|
|
77
70
|
/* setup new handle */
|
|
78
71
|
selhandle = (uv_ares_action_t*)malloc(sizeof(uv_ares_action_t));
|
|
@@ -83,52 +76,53 @@ static void CALLBACK uv_ares_socksignal_tp(void* parameter, BOOLEAN timerfired)
|
|
|
83
76
|
selhandle->close_cb = NULL;
|
|
84
77
|
selhandle->data = sockhandle->data;
|
|
85
78
|
selhandle->sock = sockhandle->sock;
|
|
86
|
-
selhandle->read =
|
|
87
|
-
|
|
79
|
+
selhandle->read =
|
|
80
|
+
(network_events.lNetworkEvents & (FD_READ | FD_CONNECT)) ? 1 : 0;
|
|
81
|
+
selhandle->write =
|
|
82
|
+
(network_events.lNetworkEvents & (FD_WRITE | FD_CONNECT)) ? 1 : 0;
|
|
88
83
|
|
|
89
84
|
uv_ares_req = &selhandle->ares_req;
|
|
90
|
-
uv_req_init(uv_ares_req);
|
|
85
|
+
uv_req_init(loop, uv_ares_req);
|
|
91
86
|
uv_ares_req->type = UV_ARES_EVENT_REQ;
|
|
92
87
|
uv_ares_req->data = selhandle;
|
|
93
88
|
|
|
94
89
|
/* post ares needs to called */
|
|
95
|
-
|
|
96
|
-
0,
|
|
97
|
-
0,
|
|
98
|
-
&uv_ares_req->overlapped)) {
|
|
99
|
-
uv_fatal_error(GetLastError(), "PostQueuedCompletionStatus");
|
|
100
|
-
}
|
|
90
|
+
POST_COMPLETION_FOR_REQ(loop, uv_ares_req);
|
|
101
91
|
}
|
|
102
92
|
}
|
|
103
93
|
|
|
104
94
|
|
|
105
95
|
/* periodically call ares to check for timeouts */
|
|
106
96
|
static void uv_ares_poll(uv_timer_t* handle, int status) {
|
|
107
|
-
|
|
108
|
-
|
|
97
|
+
uv_loop_t* loop = handle->loop;
|
|
98
|
+
if (loop->ares_channel != NULL && loop->ares_active_sockets > 0) {
|
|
99
|
+
ares_process_fd(loop->ares_channel, ARES_SOCKET_BAD, ARES_SOCKET_BAD);
|
|
109
100
|
}
|
|
110
101
|
}
|
|
111
102
|
|
|
112
103
|
|
|
113
104
|
/* callback from ares when socket operation is started */
|
|
114
|
-
static void uv_ares_sockstate_cb(void *data, ares_socket_t sock, int read,
|
|
105
|
+
static void uv_ares_sockstate_cb(void *data, ares_socket_t sock, int read,
|
|
106
|
+
int write) {
|
|
115
107
|
/* look to see if we have a handle for this socket in our list */
|
|
116
|
-
|
|
117
|
-
|
|
108
|
+
uv_loop_t* loop = (uv_loop_t*) data;
|
|
109
|
+
uv_ares_task_t* uv_handle_ares = uv_find_ares_handle(loop, sock);
|
|
118
110
|
|
|
119
111
|
int timeoutms = 0;
|
|
120
112
|
|
|
121
113
|
if (read == 0 && write == 0) {
|
|
122
114
|
/* if read and write are 0, cleanup existing data */
|
|
123
|
-
/* The code assumes that c-ares does a callback with read = 0 and
|
|
124
|
-
|
|
115
|
+
/* The code assumes that c-ares does a callback with read = 0 and */
|
|
116
|
+
/* write = 0 when the socket is closed. After we recieve this we stop */
|
|
117
|
+
/* monitoring the socket. */
|
|
125
118
|
if (uv_handle_ares != NULL) {
|
|
126
119
|
uv_req_t* uv_ares_req;
|
|
127
120
|
|
|
128
121
|
uv_handle_ares->h_close_event = CreateEvent(NULL, FALSE, FALSE, NULL);
|
|
129
122
|
/* remove Wait */
|
|
130
123
|
if (uv_handle_ares->h_wait) {
|
|
131
|
-
UnregisterWaitEx(uv_handle_ares->h_wait,
|
|
124
|
+
UnregisterWaitEx(uv_handle_ares->h_wait,
|
|
125
|
+
uv_handle_ares->h_close_event);
|
|
132
126
|
uv_handle_ares->h_wait = NULL;
|
|
133
127
|
}
|
|
134
128
|
|
|
@@ -143,17 +137,12 @@ static void uv_ares_sockstate_cb(void *data, ares_socket_t sock, int read, int w
|
|
|
143
137
|
|
|
144
138
|
/* Post request to cleanup the Task */
|
|
145
139
|
uv_ares_req = &uv_handle_ares->ares_req;
|
|
146
|
-
uv_req_init(uv_ares_req);
|
|
140
|
+
uv_req_init(loop, uv_ares_req);
|
|
147
141
|
uv_ares_req->type = UV_ARES_CLEANUP_REQ;
|
|
148
142
|
uv_ares_req->data = uv_handle_ares;
|
|
149
143
|
|
|
150
144
|
/* post ares done with socket - finish cleanup when all threads done. */
|
|
151
|
-
|
|
152
|
-
0,
|
|
153
|
-
0,
|
|
154
|
-
&uv_ares_req->overlapped)) {
|
|
155
|
-
uv_fatal_error(GetLastError(), "PostQueuedCompletionStatus");
|
|
156
|
-
}
|
|
145
|
+
POST_COMPLETION_FOR_REQ(loop, uv_ares_req);
|
|
157
146
|
} else {
|
|
158
147
|
assert(0);
|
|
159
148
|
uv_fatal_error(ERROR_INVALID_DATA, "ares_SockStateCB");
|
|
@@ -170,7 +159,7 @@ static void uv_ares_sockstate_cb(void *data, ares_socket_t sock, int read, int w
|
|
|
170
159
|
}
|
|
171
160
|
uv_handle_ares->type = UV_ARES_TASK;
|
|
172
161
|
uv_handle_ares->close_cb = NULL;
|
|
173
|
-
uv_handle_ares->data =
|
|
162
|
+
uv_handle_ares->data = loop;
|
|
174
163
|
uv_handle_ares->sock = sock;
|
|
175
164
|
uv_handle_ares->h_wait = NULL;
|
|
176
165
|
uv_handle_ares->flags = 0;
|
|
@@ -182,24 +171,26 @@ static void uv_ares_sockstate_cb(void *data, ares_socket_t sock, int read, int w
|
|
|
182
171
|
}
|
|
183
172
|
|
|
184
173
|
/* tie event to socket */
|
|
185
|
-
if (SOCKET_ERROR == WSAEventSelect(sock,
|
|
174
|
+
if (SOCKET_ERROR == WSAEventSelect(sock,
|
|
175
|
+
uv_handle_ares->h_event,
|
|
176
|
+
FD_READ | FD_WRITE | FD_CONNECT)) {
|
|
186
177
|
uv_fatal_error(WSAGetLastError(), "WSAEventSelect");
|
|
187
178
|
}
|
|
188
179
|
|
|
189
180
|
/* add handle to list */
|
|
190
|
-
uv_add_ares_handle(uv_handle_ares);
|
|
191
|
-
uv_ref();
|
|
181
|
+
uv_add_ares_handle(loop, uv_handle_ares);
|
|
182
|
+
uv_ref(loop);
|
|
192
183
|
|
|
193
184
|
/*
|
|
194
185
|
* we have a single polling timer for all ares sockets.
|
|
195
186
|
* This is preferred to using ares_timeout. See ares_timeout.c warning.
|
|
196
187
|
* if timer is not running start it, and keep socket count
|
|
197
188
|
*/
|
|
198
|
-
if (
|
|
199
|
-
uv_timer_init(&
|
|
200
|
-
uv_timer_start(&
|
|
189
|
+
if (loop->ares_active_sockets == 0) {
|
|
190
|
+
uv_timer_init(loop, &loop->ares_polling_timer);
|
|
191
|
+
uv_timer_start(&loop->ares_polling_timer, uv_ares_poll, 1000L, 1000L);
|
|
201
192
|
}
|
|
202
|
-
|
|
193
|
+
loop->ares_active_sockets++;
|
|
203
194
|
|
|
204
195
|
/* specify thread pool function to call when event is signaled */
|
|
205
196
|
if (RegisterWaitForSingleObject(&uv_handle_ares->h_wait,
|
|
@@ -221,12 +212,11 @@ static void uv_ares_sockstate_cb(void *data, ares_socket_t sock, int read, int w
|
|
|
221
212
|
|
|
222
213
|
|
|
223
214
|
/* called via uv_poll when ares completion port signaled */
|
|
224
|
-
void uv_process_ares_event_req(
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
handle->write ? handle->sock : INVALID_SOCKET);
|
|
215
|
+
void uv_process_ares_event_req(uv_loop_t* loop, uv_ares_action_t* handle,
|
|
216
|
+
uv_req_t* req) {
|
|
217
|
+
ares_process_fd(loop->ares_channel,
|
|
218
|
+
handle->read ? handle->sock : INVALID_SOCKET,
|
|
219
|
+
handle->write ? handle->sock : INVALID_SOCKET);
|
|
230
220
|
|
|
231
221
|
/* release handle for select here */
|
|
232
222
|
free(handle);
|
|
@@ -234,52 +224,47 @@ void uv_process_ares_event_req(uv_ares_action_t* handle, uv_req_t* req) {
|
|
|
234
224
|
|
|
235
225
|
|
|
236
226
|
/* called via uv_poll when ares is finished with socket */
|
|
237
|
-
void uv_process_ares_cleanup_req(
|
|
227
|
+
void uv_process_ares_cleanup_req(uv_loop_t* loop, uv_ares_task_t* handle,
|
|
228
|
+
uv_req_t* req) {
|
|
238
229
|
/* check for event complete without waiting */
|
|
239
230
|
unsigned int signaled = WaitForSingleObject(handle->h_close_event, 0);
|
|
240
231
|
|
|
241
232
|
if (signaled != WAIT_TIMEOUT) {
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
uv_unref();
|
|
233
|
+
uv_unref(loop);
|
|
245
234
|
|
|
246
235
|
/* close event handle and free uv handle memory */
|
|
247
236
|
CloseHandle(handle->h_close_event);
|
|
248
237
|
free(handle);
|
|
249
238
|
|
|
250
239
|
/* decrement active count. if it becomes 0 stop polling */
|
|
251
|
-
if (
|
|
252
|
-
|
|
253
|
-
if (
|
|
254
|
-
uv_close((uv_handle_t*)&
|
|
240
|
+
if (loop->ares_active_sockets > 0) {
|
|
241
|
+
loop->ares_active_sockets--;
|
|
242
|
+
if (loop->ares_active_sockets == 0) {
|
|
243
|
+
uv_close((uv_handle_t*) &loop->ares_polling_timer, NULL);
|
|
255
244
|
}
|
|
256
245
|
}
|
|
257
246
|
} else {
|
|
258
247
|
/* stil busy - repost and try again */
|
|
259
|
-
|
|
260
|
-
0,
|
|
261
|
-
0,
|
|
262
|
-
&req->overlapped)) {
|
|
263
|
-
uv_fatal_error(GetLastError(), "PostQueuedCompletionStatus");
|
|
264
|
-
}
|
|
248
|
+
POST_COMPLETION_FOR_REQ(loop, req);
|
|
265
249
|
}
|
|
266
250
|
}
|
|
267
251
|
|
|
268
252
|
|
|
269
253
|
/* set ares SOCK_STATE callback to our handler */
|
|
270
|
-
int uv_ares_init_options(
|
|
271
|
-
|
|
272
|
-
|
|
254
|
+
int uv_ares_init_options(uv_loop_t* loop,
|
|
255
|
+
ares_channel *channelptr,
|
|
256
|
+
struct ares_options *options,
|
|
257
|
+
int optmask) {
|
|
273
258
|
int rc;
|
|
274
259
|
|
|
275
260
|
/* only allow single init at a time */
|
|
276
|
-
if (
|
|
261
|
+
if (loop->ares_channel != NULL) {
|
|
277
262
|
return UV_EALREADY;
|
|
278
263
|
}
|
|
279
264
|
|
|
280
265
|
/* set our callback as an option */
|
|
281
266
|
options->sock_state_cb = uv_ares_sockstate_cb;
|
|
282
|
-
options->sock_state_cb_data =
|
|
267
|
+
options->sock_state_cb_data = loop;
|
|
283
268
|
optmask |= ARES_OPT_SOCK_STATE_CB;
|
|
284
269
|
|
|
285
270
|
/* We do the call to ares_init_option for caller. */
|
|
@@ -287,7 +272,7 @@ int uv_ares_init_options(ares_channel *channelptr,
|
|
|
287
272
|
|
|
288
273
|
/* if success, save channel */
|
|
289
274
|
if (rc == ARES_SUCCESS) {
|
|
290
|
-
|
|
275
|
+
loop->ares_channel = *channelptr;
|
|
291
276
|
}
|
|
292
277
|
|
|
293
278
|
return rc;
|
|
@@ -295,10 +280,10 @@ int uv_ares_init_options(ares_channel *channelptr,
|
|
|
295
280
|
|
|
296
281
|
|
|
297
282
|
/* release memory */
|
|
298
|
-
void uv_ares_destroy(ares_channel channel) {
|
|
283
|
+
void uv_ares_destroy(uv_loop_t* loop, ares_channel channel) {
|
|
299
284
|
/* only allow destroy if did init */
|
|
300
|
-
if (
|
|
285
|
+
if (loop->ares_channel != NULL) {
|
|
301
286
|
ares_destroy(channel);
|
|
302
|
-
|
|
287
|
+
loop->ares_channel = NULL;
|
|
303
288
|
}
|
|
304
289
|
}
|