noderb 0.0.4 → 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
- 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
@@ -0,0 +1,270 @@
|
|
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 <assert.h>
|
23
|
+
|
24
|
+
#include "uv.h"
|
25
|
+
#include "../uv-common.h"
|
26
|
+
#include "internal.h"
|
27
|
+
|
28
|
+
|
29
|
+
/* Winsock extension functions (ipv4) */
|
30
|
+
LPFN_CONNECTEX pConnectEx;
|
31
|
+
LPFN_ACCEPTEX pAcceptEx;
|
32
|
+
LPFN_GETACCEPTEXSOCKADDRS pGetAcceptExSockAddrs;
|
33
|
+
LPFN_DISCONNECTEX pDisconnectEx;
|
34
|
+
LPFN_TRANSMITFILE pTransmitFile;
|
35
|
+
|
36
|
+
/* Winsock extension functions (ipv6) */
|
37
|
+
LPFN_CONNECTEX pConnectEx6;
|
38
|
+
LPFN_ACCEPTEX pAcceptEx6;
|
39
|
+
LPFN_GETACCEPTEXSOCKADDRS pGetAcceptExSockAddrs6;
|
40
|
+
LPFN_DISCONNECTEX pDisconnectEx6;
|
41
|
+
LPFN_TRANSMITFILE pTransmitFile6;
|
42
|
+
|
43
|
+
/* Whether ipv6 is supported */
|
44
|
+
int uv_allow_ipv6;
|
45
|
+
|
46
|
+
/* Ip address used to bind to any port at any interface */
|
47
|
+
struct sockaddr_in uv_addr_ip4_any_;
|
48
|
+
struct sockaddr_in6 uv_addr_ip6_any_;
|
49
|
+
|
50
|
+
|
51
|
+
/*
|
52
|
+
* Retrieves the pointer to a winsock extension function.
|
53
|
+
*/
|
54
|
+
static BOOL uv_get_extension_function(SOCKET socket, GUID guid,
|
55
|
+
void **target) {
|
56
|
+
DWORD result, bytes;
|
57
|
+
|
58
|
+
result = WSAIoctl(socket,
|
59
|
+
SIO_GET_EXTENSION_FUNCTION_POINTER,
|
60
|
+
&guid,
|
61
|
+
sizeof(guid),
|
62
|
+
(void*)target,
|
63
|
+
sizeof(*target),
|
64
|
+
&bytes,
|
65
|
+
NULL,
|
66
|
+
NULL);
|
67
|
+
|
68
|
+
if (result == SOCKET_ERROR) {
|
69
|
+
*target = NULL;
|
70
|
+
return FALSE;
|
71
|
+
} else {
|
72
|
+
return TRUE;
|
73
|
+
}
|
74
|
+
}
|
75
|
+
|
76
|
+
|
77
|
+
void uv_winsock_init() {
|
78
|
+
const GUID wsaid_connectex = WSAID_CONNECTEX;
|
79
|
+
const GUID wsaid_acceptex = WSAID_ACCEPTEX;
|
80
|
+
const GUID wsaid_getacceptexsockaddrs = WSAID_GETACCEPTEXSOCKADDRS;
|
81
|
+
const GUID wsaid_disconnectex = WSAID_DISCONNECTEX;
|
82
|
+
const GUID wsaid_transmitfile = WSAID_TRANSMITFILE;
|
83
|
+
|
84
|
+
WSADATA wsa_data;
|
85
|
+
int errorno;
|
86
|
+
SOCKET dummy;
|
87
|
+
SOCKET dummy6;
|
88
|
+
|
89
|
+
/* Initialize winsock */
|
90
|
+
errorno = WSAStartup(MAKEWORD(2, 2), &wsa_data);
|
91
|
+
if (errorno != 0) {
|
92
|
+
uv_fatal_error(errorno, "WSAStartup");
|
93
|
+
}
|
94
|
+
|
95
|
+
/* Set implicit binding address used by connectEx */
|
96
|
+
uv_addr_ip4_any_ = uv_ip4_addr("0.0.0.0", 0);
|
97
|
+
uv_addr_ip6_any_ = uv_ip6_addr("::", 0);
|
98
|
+
|
99
|
+
/* Retrieve the needed winsock extension function pointers. */
|
100
|
+
dummy = socket(AF_INET, SOCK_STREAM, IPPROTO_IP);
|
101
|
+
if (dummy == INVALID_SOCKET) {
|
102
|
+
uv_fatal_error(WSAGetLastError(), "socket");
|
103
|
+
}
|
104
|
+
|
105
|
+
if (!uv_get_extension_function(dummy,
|
106
|
+
wsaid_connectex,
|
107
|
+
(void**)&pConnectEx) ||
|
108
|
+
!uv_get_extension_function(dummy,
|
109
|
+
wsaid_acceptex,
|
110
|
+
(void**)&pAcceptEx) ||
|
111
|
+
!uv_get_extension_function(dummy,
|
112
|
+
wsaid_getacceptexsockaddrs,
|
113
|
+
(void**)&pGetAcceptExSockAddrs) ||
|
114
|
+
!uv_get_extension_function(dummy,
|
115
|
+
wsaid_disconnectex,
|
116
|
+
(void**)&pDisconnectEx) ||
|
117
|
+
!uv_get_extension_function(dummy,
|
118
|
+
wsaid_transmitfile,
|
119
|
+
(void**)&pTransmitFile)) {
|
120
|
+
uv_fatal_error(WSAGetLastError(),
|
121
|
+
"WSAIoctl(SIO_GET_EXTENSION_FUNCTION_POINTER)");
|
122
|
+
}
|
123
|
+
|
124
|
+
if (closesocket(dummy) == SOCKET_ERROR) {
|
125
|
+
uv_fatal_error(WSAGetLastError(), "closesocket");
|
126
|
+
}
|
127
|
+
|
128
|
+
/* optional IPv6 versions of winsock extension functions */
|
129
|
+
dummy6 = socket(AF_INET6, SOCK_STREAM, IPPROTO_IP);
|
130
|
+
if (dummy6 != INVALID_SOCKET) {
|
131
|
+
uv_allow_ipv6 = TRUE;
|
132
|
+
|
133
|
+
if (!uv_get_extension_function(dummy6,
|
134
|
+
wsaid_connectex,
|
135
|
+
(void**)&pConnectEx6) ||
|
136
|
+
!uv_get_extension_function(dummy6,
|
137
|
+
wsaid_acceptex,
|
138
|
+
(void**)&pAcceptEx6) ||
|
139
|
+
!uv_get_extension_function(dummy6,
|
140
|
+
wsaid_getacceptexsockaddrs,
|
141
|
+
(void**)&pGetAcceptExSockAddrs6) ||
|
142
|
+
!uv_get_extension_function(dummy6,
|
143
|
+
wsaid_disconnectex,
|
144
|
+
(void**)&pDisconnectEx6) ||
|
145
|
+
!uv_get_extension_function(dummy6,
|
146
|
+
wsaid_transmitfile,
|
147
|
+
(void**)&pTransmitFile6)) {
|
148
|
+
uv_allow_ipv6 = FALSE;
|
149
|
+
}
|
150
|
+
|
151
|
+
if (closesocket(dummy6) == SOCKET_ERROR) {
|
152
|
+
uv_fatal_error(WSAGetLastError(), "closesocket");
|
153
|
+
}
|
154
|
+
}
|
155
|
+
}
|
156
|
+
|
157
|
+
|
158
|
+
int uv_ntstatus_to_winsock_error(NTSTATUS status) {
|
159
|
+
switch (status) {
|
160
|
+
case STATUS_SUCCESS:
|
161
|
+
return ERROR_SUCCESS;
|
162
|
+
|
163
|
+
case STATUS_PENDING:
|
164
|
+
return ERROR_IO_PENDING;
|
165
|
+
|
166
|
+
case STATUS_INVALID_HANDLE:
|
167
|
+
case STATUS_OBJECT_TYPE_MISMATCH:
|
168
|
+
return WSAENOTSOCK;
|
169
|
+
|
170
|
+
case STATUS_INSUFFICIENT_RESOURCES:
|
171
|
+
case STATUS_PAGEFILE_QUOTA:
|
172
|
+
case STATUS_COMMITMENT_LIMIT:
|
173
|
+
case STATUS_WORKING_SET_QUOTA:
|
174
|
+
case STATUS_NO_MEMORY:
|
175
|
+
case STATUS_CONFLICTING_ADDRESSES:
|
176
|
+
case STATUS_QUOTA_EXCEEDED:
|
177
|
+
case STATUS_TOO_MANY_PAGING_FILES:
|
178
|
+
case STATUS_REMOTE_RESOURCES:
|
179
|
+
case STATUS_TOO_MANY_ADDRESSES:
|
180
|
+
return WSAENOBUFS;
|
181
|
+
|
182
|
+
case STATUS_SHARING_VIOLATION:
|
183
|
+
case STATUS_ADDRESS_ALREADY_EXISTS:
|
184
|
+
return WSAEADDRINUSE;
|
185
|
+
|
186
|
+
case STATUS_LINK_TIMEOUT:
|
187
|
+
case STATUS_IO_TIMEOUT:
|
188
|
+
case STATUS_TIMEOUT:
|
189
|
+
return WSAETIMEDOUT;
|
190
|
+
|
191
|
+
case STATUS_GRACEFUL_DISCONNECT:
|
192
|
+
return WSAEDISCON;
|
193
|
+
|
194
|
+
case STATUS_REMOTE_DISCONNECT:
|
195
|
+
case STATUS_CONNECTION_RESET:
|
196
|
+
case STATUS_LINK_FAILED:
|
197
|
+
case STATUS_CONNECTION_DISCONNECTED:
|
198
|
+
case STATUS_PORT_UNREACHABLE:
|
199
|
+
return WSAECONNRESET;
|
200
|
+
|
201
|
+
case STATUS_LOCAL_DISCONNECT:
|
202
|
+
case STATUS_TRANSACTION_ABORTED:
|
203
|
+
case STATUS_CONNECTION_ABORTED:
|
204
|
+
return WSAECONNABORTED;
|
205
|
+
|
206
|
+
case STATUS_BAD_NETWORK_PATH:
|
207
|
+
case STATUS_NETWORK_UNREACHABLE:
|
208
|
+
case STATUS_PROTOCOL_UNREACHABLE:
|
209
|
+
return WSAENETUNREACH;
|
210
|
+
|
211
|
+
case STATUS_HOST_UNREACHABLE:
|
212
|
+
return WSAEHOSTUNREACH;
|
213
|
+
|
214
|
+
case STATUS_CANCELLED:
|
215
|
+
case STATUS_REQUEST_ABORTED:
|
216
|
+
return WSAEINTR;
|
217
|
+
|
218
|
+
case STATUS_BUFFER_OVERFLOW:
|
219
|
+
case STATUS_INVALID_BUFFER_SIZE:
|
220
|
+
return WSAEMSGSIZE;
|
221
|
+
|
222
|
+
case STATUS_BUFFER_TOO_SMALL:
|
223
|
+
case STATUS_ACCESS_VIOLATION:
|
224
|
+
return WSAEFAULT;
|
225
|
+
|
226
|
+
case STATUS_DEVICE_NOT_READY:
|
227
|
+
case STATUS_REQUEST_NOT_ACCEPTED:
|
228
|
+
return WSAEWOULDBLOCK;
|
229
|
+
|
230
|
+
case STATUS_INVALID_NETWORK_RESPONSE:
|
231
|
+
case STATUS_NETWORK_BUSY:
|
232
|
+
case STATUS_NO_SUCH_DEVICE:
|
233
|
+
case STATUS_NO_SUCH_FILE:
|
234
|
+
case STATUS_OBJECT_PATH_NOT_FOUND:
|
235
|
+
case STATUS_OBJECT_NAME_NOT_FOUND:
|
236
|
+
case STATUS_UNEXPECTED_NETWORK_ERROR:
|
237
|
+
return WSAENETDOWN;
|
238
|
+
|
239
|
+
case STATUS_INVALID_CONNECTION:
|
240
|
+
return WSAENOTCONN;
|
241
|
+
|
242
|
+
case STATUS_REMOTE_NOT_LISTENING:
|
243
|
+
case STATUS_CONNECTION_REFUSED:
|
244
|
+
return WSAECONNREFUSED;
|
245
|
+
|
246
|
+
case STATUS_PIPE_DISCONNECTED:
|
247
|
+
return WSAESHUTDOWN;
|
248
|
+
|
249
|
+
case STATUS_INVALID_ADDRESS:
|
250
|
+
case STATUS_INVALID_ADDRESS_COMPONENT:
|
251
|
+
return WSAEADDRNOTAVAIL;
|
252
|
+
|
253
|
+
case STATUS_NOT_SUPPORTED:
|
254
|
+
case STATUS_NOT_IMPLEMENTED:
|
255
|
+
return WSAEOPNOTSUPP;
|
256
|
+
|
257
|
+
case STATUS_ACCESS_DENIED:
|
258
|
+
return WSAEACCES;
|
259
|
+
|
260
|
+
default:
|
261
|
+
if (status & ((FACILITY_NTWIN32 << 16) | ERROR_SEVERITY_ERROR)) {
|
262
|
+
/* It's a windows error that has been previously mapped to an */
|
263
|
+
/* ntstatus code. */
|
264
|
+
return (DWORD) (status & 0xffff);
|
265
|
+
} else {
|
266
|
+
/* The default fallback for unmappable ntstatus codes. */
|
267
|
+
return WSAEINVAL;
|
268
|
+
}
|
269
|
+
}
|
270
|
+
}
|
@@ -0,0 +1,134 @@
|
|
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
|
+
#ifndef UV_WIN_WINSOCK_H_
|
23
|
+
#define UV_WIN_WINSOCK_H_
|
24
|
+
|
25
|
+
#include <winsock2.h>
|
26
|
+
#include <mswsock.h>
|
27
|
+
#include <ws2tcpip.h>
|
28
|
+
#include <windows.h>
|
29
|
+
|
30
|
+
|
31
|
+
/*
|
32
|
+
* Guids and typedefs for winsock extension functions
|
33
|
+
* Mingw32 doesn't have these :-(
|
34
|
+
*/
|
35
|
+
#ifndef WSAID_ACCEPTEX
|
36
|
+
# define WSAID_ACCEPTEX \
|
37
|
+
{0xb5367df1, 0xcbac, 0x11cf, \
|
38
|
+
{0x95, 0xca, 0x00, 0x80, 0x5f, 0x48, 0xa1, 0x92}}
|
39
|
+
|
40
|
+
# define WSAID_CONNECTEX \
|
41
|
+
{0x25a207b9, 0xddf3, 0x4660, \
|
42
|
+
{0x8e, 0xe9, 0x76, 0xe5, 0x8c, 0x74, 0x06, 0x3e}}
|
43
|
+
|
44
|
+
# define WSAID_GETACCEPTEXSOCKADDRS \
|
45
|
+
{0xb5367df2, 0xcbac, 0x11cf, \
|
46
|
+
{0x95, 0xca, 0x00, 0x80, 0x5f, 0x48, 0xa1, 0x92}}
|
47
|
+
|
48
|
+
# define WSAID_DISCONNECTEX \
|
49
|
+
{0x7fda2e11, 0x8630, 0x436f, \
|
50
|
+
{0xa0, 0x31, 0xf5, 0x36, 0xa6, 0xee, 0xc1, 0x57}}
|
51
|
+
|
52
|
+
# define WSAID_TRANSMITFILE \
|
53
|
+
{0xb5367df0, 0xcbac, 0x11cf, \
|
54
|
+
{0x95, 0xca, 0x00, 0x80, 0x5f, 0x48, 0xa1, 0x92}}
|
55
|
+
|
56
|
+
typedef BOOL PASCAL (*LPFN_ACCEPTEX)
|
57
|
+
(SOCKET sListenSocket,
|
58
|
+
SOCKET sAcceptSocket,
|
59
|
+
PVOID lpOutputBuffer,
|
60
|
+
DWORD dwReceiveDataLength,
|
61
|
+
DWORD dwLocalAddressLength,
|
62
|
+
DWORD dwRemoteAddressLength,
|
63
|
+
LPDWORD lpdwBytesReceived,
|
64
|
+
LPOVERLAPPED lpOverlapped);
|
65
|
+
|
66
|
+
typedef BOOL PASCAL (*LPFN_CONNECTEX)
|
67
|
+
(SOCKET s,
|
68
|
+
const struct sockaddr* name,
|
69
|
+
int namelen,
|
70
|
+
PVOID lpSendBuffer,
|
71
|
+
DWORD dwSendDataLength,
|
72
|
+
LPDWORD lpdwBytesSent,
|
73
|
+
LPOVERLAPPED lpOverlapped);
|
74
|
+
|
75
|
+
typedef void PASCAL (*LPFN_GETACCEPTEXSOCKADDRS)
|
76
|
+
(PVOID lpOutputBuffer,
|
77
|
+
DWORD dwReceiveDataLength,
|
78
|
+
DWORD dwLocalAddressLength,
|
79
|
+
DWORD dwRemoteAddressLength,
|
80
|
+
LPSOCKADDR* LocalSockaddr,
|
81
|
+
LPINT LocalSockaddrLength,
|
82
|
+
LPSOCKADDR* RemoteSockaddr,
|
83
|
+
LPINT RemoteSockaddrLength);
|
84
|
+
|
85
|
+
typedef BOOL PASCAL (*LPFN_DISCONNECTEX)
|
86
|
+
(SOCKET hSocket,
|
87
|
+
LPOVERLAPPED lpOverlapped,
|
88
|
+
DWORD dwFlags,
|
89
|
+
DWORD reserved);
|
90
|
+
|
91
|
+
typedef BOOL PASCAL (*LPFN_TRANSMITFILE)
|
92
|
+
(SOCKET hSocket,
|
93
|
+
HANDLE hFile,
|
94
|
+
DWORD nNumberOfBytesToWrite,
|
95
|
+
DWORD nNumberOfBytesPerSend,
|
96
|
+
LPOVERLAPPED lpOverlapped,
|
97
|
+
LPTRANSMIT_FILE_BUFFERS lpTransmitBuffers,
|
98
|
+
DWORD dwFlags);
|
99
|
+
#endif
|
100
|
+
|
101
|
+
/*
|
102
|
+
* MinGW is missing these too
|
103
|
+
*/
|
104
|
+
#ifndef SO_UPDATE_CONNECT_CONTEXT
|
105
|
+
# define SO_UPDATE_CONNECT_CONTEXT 0x7010
|
106
|
+
#endif
|
107
|
+
|
108
|
+
#ifndef IPV6_V6ONLY
|
109
|
+
#define IPV6_V6ONLY 27
|
110
|
+
#endif
|
111
|
+
|
112
|
+
|
113
|
+
/* Winsock extension functions (ipv4) */
|
114
|
+
extern LPFN_CONNECTEX pConnectEx;
|
115
|
+
extern LPFN_ACCEPTEX pAcceptEx;
|
116
|
+
extern LPFN_GETACCEPTEXSOCKADDRS pGetAcceptExSockAddrs;
|
117
|
+
extern LPFN_DISCONNECTEX pDisconnectEx;
|
118
|
+
extern LPFN_TRANSMITFILE pTransmitFile;
|
119
|
+
|
120
|
+
/* Winsock extension functions (ipv6) */
|
121
|
+
extern LPFN_CONNECTEX pConnectEx6;
|
122
|
+
extern LPFN_ACCEPTEX pAcceptEx6;
|
123
|
+
extern LPFN_GETACCEPTEXSOCKADDRS pGetAcceptExSockAddrs6;
|
124
|
+
extern LPFN_DISCONNECTEX pDisconnectEx6;
|
125
|
+
extern LPFN_TRANSMITFILE pTransmitFile6;
|
126
|
+
|
127
|
+
/* Whether ipv6 is supported */
|
128
|
+
extern int uv_allow_ipv6;
|
129
|
+
|
130
|
+
/* Ip address used to bind to any port at any interface */
|
131
|
+
extern struct sockaddr_in uv_addr_ip4_any_;
|
132
|
+
extern struct sockaddr_in6 uv_addr_ip6_any_;
|
133
|
+
|
134
|
+
#endif /* UV_WIN_WINSOCK_H_ */
|
@@ -26,6 +26,8 @@
|
|
26
26
|
#include <stdio.h>
|
27
27
|
#include <string.h> /* strlen */
|
28
28
|
|
29
|
+
static uv_loop_t* loop;
|
30
|
+
|
29
31
|
ares_channel channel;
|
30
32
|
struct ares_options options;
|
31
33
|
int optmask;
|
@@ -67,7 +69,7 @@ static void prep_tcploopback()
|
|
67
69
|
options.tcp_port = htons(TEST_PORT_2);
|
68
70
|
options.flags = ARES_FLAG_USEVC;
|
69
71
|
|
70
|
-
rc = uv_ares_init_options(&channel, &options, optmask);
|
72
|
+
rc = uv_ares_init_options(loop, &channel, &options, optmask);
|
71
73
|
|
72
74
|
ASSERT(rc == ARES_SUCCESS);
|
73
75
|
}
|
@@ -85,11 +87,13 @@ BENCHMARK_IMPL(gethostbyname) {
|
|
85
87
|
}
|
86
88
|
|
87
89
|
uv_init();
|
90
|
+
loop = uv_default_loop();
|
91
|
+
|
88
92
|
ares_callbacks = 0;
|
89
93
|
ares_errors = 0;
|
90
94
|
|
91
|
-
uv_update_time();
|
92
|
-
start_time = uv_now();
|
95
|
+
uv_update_time(loop);
|
96
|
+
start_time = uv_now(loop);
|
93
97
|
|
94
98
|
prep_tcploopback();
|
95
99
|
|
@@ -101,11 +105,11 @@ BENCHMARK_IMPL(gethostbyname) {
|
|
101
105
|
&argument);
|
102
106
|
}
|
103
107
|
|
104
|
-
uv_run();
|
108
|
+
uv_run(loop);
|
105
109
|
|
106
|
-
uv_ares_destroy(channel);
|
110
|
+
uv_ares_destroy(loop, channel);
|
107
111
|
|
108
|
-
end_time = uv_now();
|
112
|
+
end_time = uv_now(loop);
|
109
113
|
|
110
114
|
if (ares_errors > 0) {
|
111
115
|
printf("There were %d failures\n", ares_errors);
|
@@ -32,6 +32,8 @@
|
|
32
32
|
|
33
33
|
const char* name = "localhost";
|
34
34
|
|
35
|
+
static uv_loop_t* loop;
|
36
|
+
|
35
37
|
static uv_getaddrinfo_t handles[CONCURRENT_CALLS];
|
36
38
|
|
37
39
|
static int calls_initiated = 0;
|
@@ -58,7 +60,7 @@ static void getaddrinfo_initiate(uv_getaddrinfo_t* handle) {
|
|
58
60
|
|
59
61
|
calls_initiated++;
|
60
62
|
|
61
|
-
r = uv_getaddrinfo(handle, &getaddrinfo_cb, name, NULL, NULL);
|
63
|
+
r = uv_getaddrinfo(loop, handle, &getaddrinfo_cb, name, NULL, NULL);
|
62
64
|
ASSERT(r == 0);
|
63
65
|
}
|
64
66
|
|
@@ -66,19 +68,20 @@ static void getaddrinfo_initiate(uv_getaddrinfo_t* handle) {
|
|
66
68
|
BENCHMARK_IMPL(getaddrinfo) {
|
67
69
|
int i;
|
68
70
|
|
69
|
-
uv_init();
|
71
|
+
uv_init(loop);
|
72
|
+
loop = uv_default_loop();
|
70
73
|
|
71
|
-
uv_update_time();
|
72
|
-
start_time = uv_now();
|
74
|
+
uv_update_time(loop);
|
75
|
+
start_time = uv_now(loop);
|
73
76
|
|
74
77
|
for (i = 0; i < CONCURRENT_CALLS; i++) {
|
75
78
|
getaddrinfo_initiate(&handles[i]);
|
76
79
|
}
|
77
80
|
|
78
|
-
uv_run();
|
81
|
+
uv_run(loop);
|
79
82
|
|
80
|
-
uv_update_time();
|
81
|
-
end_time = uv_now();
|
83
|
+
uv_update_time(loop);
|
84
|
+
end_time = uv_now(loop);
|
82
85
|
|
83
86
|
ASSERT(calls_initiated == TOTAL_CALLS);
|
84
87
|
ASSERT(calls_completed == TOTAL_CALLS);
|
@@ -29,6 +29,16 @@ BENCHMARK_DECLARE (tcp_pump100_client)
|
|
29
29
|
BENCHMARK_DECLARE (tcp_pump1_client)
|
30
30
|
BENCHMARK_DECLARE (pipe_pump100_client)
|
31
31
|
BENCHMARK_DECLARE (pipe_pump1_client)
|
32
|
+
BENCHMARK_DECLARE (udp_packet_storm_1v1)
|
33
|
+
BENCHMARK_DECLARE (udp_packet_storm_1v10)
|
34
|
+
BENCHMARK_DECLARE (udp_packet_storm_1v100)
|
35
|
+
BENCHMARK_DECLARE (udp_packet_storm_1v1000)
|
36
|
+
BENCHMARK_DECLARE (udp_packet_storm_10v10)
|
37
|
+
BENCHMARK_DECLARE (udp_packet_storm_10v100)
|
38
|
+
BENCHMARK_DECLARE (udp_packet_storm_10v1000)
|
39
|
+
BENCHMARK_DECLARE (udp_packet_storm_100v100)
|
40
|
+
BENCHMARK_DECLARE (udp_packet_storm_100v1000)
|
41
|
+
BENCHMARK_DECLARE (udp_packet_storm_1000v1000)
|
32
42
|
BENCHMARK_DECLARE (gethostbyname)
|
33
43
|
BENCHMARK_DECLARE (getaddrinfo)
|
34
44
|
BENCHMARK_DECLARE (spawn)
|
@@ -68,6 +78,17 @@ TASK_LIST_START
|
|
68
78
|
BENCHMARK_ENTRY (pipe_pound_1000)
|
69
79
|
BENCHMARK_HELPER (pipe_pound_1000, pipe_echo_server)
|
70
80
|
|
81
|
+
BENCHMARK_ENTRY (udp_packet_storm_1v1)
|
82
|
+
BENCHMARK_ENTRY (udp_packet_storm_1v10)
|
83
|
+
BENCHMARK_ENTRY (udp_packet_storm_1v100)
|
84
|
+
BENCHMARK_ENTRY (udp_packet_storm_1v1000)
|
85
|
+
BENCHMARK_ENTRY (udp_packet_storm_10v10)
|
86
|
+
BENCHMARK_ENTRY (udp_packet_storm_10v100)
|
87
|
+
BENCHMARK_ENTRY (udp_packet_storm_10v1000)
|
88
|
+
BENCHMARK_ENTRY (udp_packet_storm_100v100)
|
89
|
+
BENCHMARK_ENTRY (udp_packet_storm_100v1000)
|
90
|
+
BENCHMARK_ENTRY (udp_packet_storm_1000v1000)
|
91
|
+
|
71
92
|
BENCHMARK_ENTRY (gethostbyname)
|
72
93
|
BENCHMARK_HELPER (gethostbyname, dns_server)
|
73
94
|
|
@@ -46,13 +46,15 @@ typedef struct buf_s {
|
|
46
46
|
|
47
47
|
static char PING[] = "PING\n";
|
48
48
|
|
49
|
+
static uv_loop_t* loop;
|
50
|
+
|
49
51
|
static buf_t* buf_freelist = NULL;
|
50
52
|
static int pinger_shutdown_cb_called;
|
51
53
|
static int completed_pingers = 0;
|
52
54
|
static int64_t start_time;
|
53
55
|
|
54
56
|
|
55
|
-
static uv_buf_t buf_alloc(
|
57
|
+
static uv_buf_t buf_alloc(uv_handle_t* tcp, size_t size) {
|
56
58
|
buf_t* ab;
|
57
59
|
|
58
60
|
ab = buf_freelist;
|
@@ -124,13 +126,13 @@ static void pinger_shutdown_cb(uv_shutdown_t* req, int status) {
|
|
124
126
|
|
125
127
|
|
126
128
|
static void pinger_read_cb(uv_stream_t* tcp, ssize_t nread, uv_buf_t buf) {
|
127
|
-
|
129
|
+
ssize_t i;
|
128
130
|
pinger_t* pinger;
|
129
131
|
|
130
132
|
pinger = (pinger_t*)tcp->data;
|
131
133
|
|
132
134
|
if (nread < 0) {
|
133
|
-
ASSERT(uv_last_error().code == UV_EOF);
|
135
|
+
ASSERT(uv_last_error(loop).code == UV_EOF);
|
134
136
|
|
135
137
|
if (buf.base) {
|
136
138
|
buf_free(buf);
|
@@ -148,7 +150,7 @@ static void pinger_read_cb(uv_stream_t* tcp, ssize_t nread, uv_buf_t buf) {
|
|
148
150
|
pinger->state = (pinger->state + 1) % (sizeof(PING) - 1);
|
149
151
|
if (pinger->state == 0) {
|
150
152
|
pinger->pongs++;
|
151
|
-
if (uv_now() - start_time > TIME) {
|
153
|
+
if (uv_now(loop) - start_time > TIME) {
|
152
154
|
uv_shutdown(&pinger->shutdown_req, (uv_stream_t*) tcp, pinger_shutdown_cb);
|
153
155
|
break;
|
154
156
|
} else {
|
@@ -185,7 +187,7 @@ static void pinger_new() {
|
|
185
187
|
pinger->pongs = 0;
|
186
188
|
|
187
189
|
/* Try to connec to the server and do NUM_PINGS ping-pongs. */
|
188
|
-
r = uv_tcp_init(&pinger->tcp);
|
190
|
+
r = uv_tcp_init(loop, &pinger->tcp);
|
189
191
|
ASSERT(!r);
|
190
192
|
|
191
193
|
pinger->tcp.data = pinger;
|
@@ -199,10 +201,12 @@ static void pinger_new() {
|
|
199
201
|
|
200
202
|
BENCHMARK_IMPL(ping_pongs) {
|
201
203
|
uv_init();
|
202
|
-
|
204
|
+
loop = uv_default_loop();
|
205
|
+
|
206
|
+
start_time = uv_now(loop);
|
203
207
|
|
204
208
|
pinger_new();
|
205
|
-
uv_run();
|
209
|
+
uv_run(loop);
|
206
210
|
|
207
211
|
ASSERT(completed_pingers == 1);
|
208
212
|
|