cool.io 1.0.0 → 1.9.0

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.
Files changed (83) hide show
  1. checksums.yaml +7 -0
  2. data/.github/workflows/test.yaml +54 -0
  3. data/.gitignore +30 -0
  4. data/.rspec +3 -0
  5. data/{CHANGES → CHANGES.md} +175 -79
  6. data/{README.markdown → README.md} +43 -49
  7. data/Rakefile +44 -69
  8. data/appveyor.yml +18 -0
  9. data/cool.io.gemspec +18 -131
  10. data/examples/callbacked_echo_server.rb +24 -0
  11. data/ext/cool.io/buffer.c +781 -0
  12. data/ext/cool.io/cool.io.h +13 -0
  13. data/ext/cool.io/cool.io_ext.c +1 -0
  14. data/ext/cool.io/ev_wrap.h +4 -2
  15. data/ext/cool.io/extconf.rb +27 -16
  16. data/ext/cool.io/iowatcher.c +17 -8
  17. data/ext/cool.io/loop.c +36 -84
  18. data/ext/cool.io/stat_watcher.c +103 -25
  19. data/ext/cool.io/timer_watcher.c +3 -3
  20. data/ext/cool.io/utils.c +5 -0
  21. data/ext/cool.io/watcher.h +1 -1
  22. data/ext/libev/Changes +152 -3
  23. data/ext/libev/LICENSE +2 -1
  24. data/ext/libev/README +8 -8
  25. data/ext/libev/ev.c +1719 -348
  26. data/ext/libev/ev.h +146 -118
  27. data/ext/libev/ev_epoll.c +71 -20
  28. data/ext/libev/ev_kqueue.c +36 -16
  29. data/ext/libev/ev_poll.c +14 -11
  30. data/ext/libev/ev_port.c +43 -18
  31. data/ext/libev/ev_select.c +82 -25
  32. data/ext/libev/ev_vars.h +28 -21
  33. data/ext/libev/ev_win32.c +19 -10
  34. data/ext/libev/ev_wrap.h +166 -152
  35. data/ext/libev/test_libev_win32.c +1 -1
  36. data/gems.rb +9 -0
  37. data/lib/cool.io/async_watcher.rb +1 -1
  38. data/lib/cool.io/custom_require.rb +9 -0
  39. data/lib/cool.io/dns_resolver.rb +30 -22
  40. data/lib/cool.io/dsl.rb +32 -28
  41. data/lib/cool.io/io.rb +55 -35
  42. data/lib/cool.io/iowatcher.rb +1 -1
  43. data/lib/cool.io/listener.rb +35 -17
  44. data/lib/cool.io/loop.rb +17 -25
  45. data/lib/cool.io/meta.rb +6 -5
  46. data/lib/cool.io/server.rb +5 -4
  47. data/lib/cool.io/socket.rb +41 -30
  48. data/lib/cool.io/timer_watcher.rb +1 -1
  49. data/lib/cool.io/version.rb +7 -0
  50. data/lib/cool.io.rb +11 -10
  51. data/lib/coolio.rb +1 -1
  52. data/libev_ruby_gil.diff +175 -0
  53. data/libev_win_select.diff +130 -0
  54. data/spec/async_watcher_spec.rb +5 -5
  55. data/spec/dns_spec.rb +27 -8
  56. data/spec/iobuffer_spec.rb +147 -0
  57. data/spec/spec_helper.rb +15 -1
  58. data/spec/stat_watcher_spec.rb +81 -0
  59. data/spec/tcp_server_spec.rb +225 -0
  60. data/spec/tcp_socket_spec.rb +185 -0
  61. data/spec/timer_watcher_spec.rb +23 -19
  62. data/spec/udp_socket_spec.rb +58 -0
  63. data/spec/unix_listener_spec.rb +8 -8
  64. data/spec/unix_server_spec.rb +10 -8
  65. metadata +109 -112
  66. data/VERSION +0 -1
  67. data/examples/httpclient.rb +0 -38
  68. data/ext/http11_client/.gitignore +0 -5
  69. data/ext/http11_client/LICENSE +0 -31
  70. data/ext/http11_client/ext_help.h +0 -14
  71. data/ext/http11_client/extconf.rb +0 -6
  72. data/ext/http11_client/http11_client.c +0 -300
  73. data/ext/http11_client/http11_parser.c +0 -403
  74. data/ext/http11_client/http11_parser.h +0 -48
  75. data/ext/http11_client/http11_parser.rl +0 -173
  76. data/lib/cool.io/eventmachine.rb +0 -234
  77. data/lib/cool.io/http_client.rb +0 -419
  78. data/lib/rev.rb +0 -4
  79. data/spec/possible_tests/schedules_other_threads.rb +0 -48
  80. data/spec/possible_tests/test_on_resolve_failed.rb +0 -9
  81. data/spec/possible_tests/test_resolves.rb +0 -27
  82. data/spec/possible_tests/test_write_during_resolve.rb +0 -27
  83. data/spec/possible_tests/works_straight.rb +0 -71
data/ext/libev/Changes CHANGED
@@ -1,5 +1,154 @@
1
1
  Revision history for libev, a high-performance and full-featured event loop.
2
2
 
3
+ 4.24 Wed Dec 28 05:19:55 CET 2016
4
+ - bump version to 4.24, as the release tarball inexplicably
5
+ didn't have the right version in ev.h, even though the cvs-tagged
6
+ version did have the right one (reported by Ales Teska).
7
+
8
+ 4.23 Wed Nov 16 18:23:41 CET 2016
9
+ - move some declarations at the beginning to help certain retarded
10
+ microsoft compilers, even though their documentation claims
11
+ otherwise (reported by Ruslan Osmanov).
12
+
13
+ 4.22 Sun Dec 20 22:11:50 CET 2015
14
+ - when epoll detects unremovable fds in the fd set, rebuild
15
+ only the epoll descriptor, not the signal pipe, to avoid
16
+ SIGPIPE in ev_async_send. This doesn't solve it on fork,
17
+ so document what needs to be done in ev_loop_fork
18
+ (analyzed by Benjamin Mahler).
19
+ - remove superfluous sys/timeb.h include on win32
20
+ (analyzed by Jason Madden).
21
+ - updated libecb.
22
+
23
+ 4.20 Sat Jun 20 13:01:43 CEST 2015
24
+ - prefer noexcept over throw () with C++ 11.
25
+ - update ecb.h due to incompatibilities with c11.
26
+ - fix a potential aliasing issue when reading and writing
27
+ watcher callbacks.
28
+
29
+ 4.19 Thu Sep 25 08:18:25 CEST 2014
30
+ - ev.h wasn't valid C++ anymore, which tripped compilers other than
31
+ clang, msvc or gcc (analyzed by Raphael 'kena' Poss). Unfortunately,
32
+ C++ doesn't support typedefs for function pointers fully, so the affected
33
+ declarations have to spell out the types each time.
34
+ - when not using autoconf, tighten the check for clock_gettime and related
35
+ functionality.
36
+
37
+ 4.18 Fri Sep 5 17:55:26 CEST 2014
38
+ - events on files were not always generated properly with the
39
+ epoll backend (testcase by Assaf Inbal).
40
+ - mark event pipe fd as cloexec after a fork (analyzed by Sami Farin).
41
+ - (ecb) support m68k, m88k and sh (patch by Miod Vallat).
42
+ - use a reasonable fallback for EV_NSIG instead of erroring out
43
+ when we can't detect the signal set size.
44
+ - in the absence of autoconf, do not use the clock syscall
45
+ on glibc >= 2.17 (avoids the syscall AND -lrt on systems
46
+ doing clock_gettime in userspace).
47
+ - ensure extern "C" function pointers are used for externally-visible
48
+ loop callbacks (not watcher callbacks yet).
49
+ - (ecb) work around memory barriers and volatile apparently both being
50
+ broken in visual studio 2008 and later (analysed and patch by Nicolas Noble).
51
+
52
+ 4.15 Fri Mar 1 12:04:50 CET 2013
53
+ - destroying a non-default loop would stop the global waitpid
54
+ watcher (Denis Bilenko).
55
+ - queueing pending watchers of higher priority from a watcher now invokes
56
+ them in a timely fashion (reported by Denis Bilenko).
57
+ - add throw() to all libev functions that cannot throw exceptions, for
58
+ further code size decrease when compiling for C++.
59
+ - add throw () to callbacks that must not throw exceptions (allocator,
60
+ syserr, loop acquire/release, periodic reschedule cbs).
61
+ - fix event_base_loop return code, add event_get_callback, event_base_new,
62
+ event_base_get_method calls to improve libevent 1.x emulation and add
63
+ some libevent 2.x functionality (based on a patch by Jeff Davey).
64
+ - add more memory fences to fix a bug reported by Jeff Davey. Better
65
+ be overfenced than underprotected.
66
+ - ev_run now returns a boolean status (true meaning watchers are
67
+ still active).
68
+ - ev_once: undef EV_ERROR in ev_kqueue.c, to avoid clashing with
69
+ libev's EV_ERROR (reported by 191919).
70
+ - (ecb) add memory fence support for xlC (Darin McBride).
71
+ - (ecb) add memory fence support for gcc-mips (Anton Kirilov).
72
+ - (ecb) add memory fence support for gcc-alpha (Christian Weisgerber).
73
+ - work around some kernels losing file descriptors by leaking
74
+ the kqueue descriptor in the child.
75
+ - work around linux inotify not reporting IN_ATTRIB changes for directories
76
+ in many cases.
77
+ - include sys/syscall.h instead of plain syscall.h.
78
+ - check for io watcher loops in ev_verify, check for the most
79
+ common reported usage bug in ev_io_start.
80
+ - choose socket vs. WSASocket at compiletime using EV_USE_WSASOCKET.
81
+ - always use WSASend/WSARecv directly on windows, hoping that this
82
+ works in all cases (unlike read/write/send/recv...).
83
+ - try to detect signals around a fork faster (test program by
84
+ Denis Bilenko).
85
+ - work around recent glibc versions that leak memory in realloc.
86
+ - rename ev::embed::set to ev::embed::set_embed to avoid clashing
87
+ the watcher base set (loop) method.
88
+ - rewrite the async/signal pipe logic to always keep a valid fd, which
89
+ simplifies (and hopefully correctifies :) the race checking
90
+ on fork, at the cost of one extra fd.
91
+ - add fat, msdos, jffs2, ramfs, ntfs and btrfs to the list of
92
+ inotify-supporting filesystems.
93
+ - move orig_CFLAGS assignment to after AC_INIT, as newer autoconf
94
+ versions ignore it before
95
+ (https://bugzilla.redhat.com/show_bug.cgi?id=908096).
96
+ - add some untested android support.
97
+ - enum expressions must be of type int (reported by Juan Pablo L).
98
+
99
+ 4.11 Sat Feb 4 19:52:39 CET 2012
100
+ - INCOMPATIBLE CHANGE: ev_timer_again now clears the pending status, as
101
+ was documented already, but not implemented in the repeating case.
102
+ - new compiletime symbols: EV_NO_SMP and EV_NO_THREADS.
103
+ - fix a race where the workaround against the epoll fork bugs
104
+ caused signals to not be handled anymore.
105
+ - correct backend_fudge for most backends, and implement a windows
106
+ specific workaround to avoid looping because we call both
107
+ select and Sleep, both with different time resolutions.
108
+ - document range and guarantees of ev_sleep.
109
+ - document reasonable ranges for periodics interval and offset.
110
+ - rename backend_fudge to backend_mintime to avoid future confusion :)
111
+ - change the default periodic reschedule function to hopefully be more
112
+ exact and correct even in corner cases or in the far future.
113
+ - do not rely on -lm anymore: use it when available but use our
114
+ own floor () if it is missing. This should make it easier to embed,
115
+ as no external libraries are required.
116
+ - strategically import macros from libecb and mark rarely-used functions
117
+ as cache-cold (saving almost 2k code size on typical amd64 setups).
118
+ - add Symbols.ev and Symbols.event files, that were missing.
119
+ - fix backend_mintime value for epoll (was 1/1024, is 1/1000 now).
120
+ - fix #3 "be smart about timeouts" to not "deadlock" when
121
+ timeout == now, also improve the section overall.
122
+ - avoid "AVOIDING FINISHING BEFORE RETURNING" idiom.
123
+ - support new EV_API_STATIC mode to make all libev symbols
124
+ static.
125
+ - supply default CFLAGS of -g -O3 with gcc when original CFLAGS
126
+ were empty.
127
+
128
+ 4.04 Wed Feb 16 09:01:51 CET 2011
129
+ - fix two problems in the native win32 backend, where reuse of fd's
130
+ with different underlying handles caused handles not to be removed
131
+ or added to the select set (analyzed and tested by Bert Belder).
132
+ - do no rely on ceil() in ev_e?poll.c.
133
+ - backport libev to HP-UX versions before 11 v3.
134
+ - configure did not detect nanosleep and clock_gettime properly when
135
+ they are available in the libc (as opposed to -lrt).
136
+
137
+ 4.03 Tue Jan 11 14:37:25 CET 2011
138
+ - officially support polling files with all backends.
139
+ - support files, /dev/zero etc. the same way as select in the epoll
140
+ backend, by generating events on our own.
141
+ - ports backend: work around solaris bug 6874410 and many related ones
142
+ (EINTR, maybe more), with no performance loss (note that the solaris
143
+ bug report is actually wrong, reality is far more bizarre and broken
144
+ than that).
145
+ - define EV_READ/EV_WRITE as macros in event.h, as some programs use
146
+ #ifdef to test for them.
147
+ - new (experimental) function: ev_feed_signal.
148
+ - new (to become default) EVFLAG_NOSIGMASK flag.
149
+ - new EVBACKEND_MASK symbol.
150
+ - updated COMMON IDIOMS SECTION.
151
+
3
152
  4.01 Fri Nov 5 21:51:29 CET 2010
4
153
  - automake fucked it up, apparently, --add-missing -f is not quite enough
5
154
  to make it update its files, so 4.00 didn't install ev++.h and
@@ -70,7 +219,7 @@ Revision history for libev, a high-performance and full-featured event loop.
70
219
  that this is a race condition regardless of EV_SIGNALFD.
71
220
  - backport inotify code to C89.
72
221
  - inotify file descriptors could leak into child processes.
73
- - ev_stat watchers could keep an errornous extra ref on the loop,
222
+ - ev_stat watchers could keep an erroneous extra ref on the loop,
74
223
  preventing exit when unregistering all watchers (testcases
75
224
  provided by ry@tinyclouds.org).
76
225
  - implement EV_WIN32_HANDLE_TO_FD and EV_WIN32_CLOSE_FD configuration
@@ -138,8 +287,8 @@ Revision history for libev, a high-performance and full-featured event loop.
138
287
  Malek Hadj-Ali).
139
288
  - implement ev_suspend and ev_resume.
140
289
  - new EV_CUSTOM revents flag for use by applications.
141
- - add documentation section about priorites.
142
- - add a glossary to the dcoumentation.
290
+ - add documentation section about priorities.
291
+ - add a glossary to the documentation.
143
292
  - extend the ev_fork description slightly.
144
293
  - optimize a jump out of call_pending.
145
294
 
data/ext/libev/LICENSE CHANGED
@@ -1,4 +1,5 @@
1
- All files in libev are Copyright (C)2007,2008,2009 Marc Alexander Lehmann.
1
+ All files in libev are
2
+ Copyright (c)2007,2008,2009,2010,2011,2012,2013 Marc Alexander Lehmann.
2
3
 
3
4
  Redistribution and use in source and binary forms, with or without
4
5
  modification, are permitted provided that the following conditions are
data/ext/libev/README CHANGED
@@ -24,23 +24,23 @@ ABOUT
24
24
  - relative timers/timeouts (handle time jumps).
25
25
  - fast intra-thread communication between multiple
26
26
  event loops (with optional fast linux eventfd backend).
27
- - extremely easy to embed.
28
- - very small codebase, no bloated library.
27
+ - extremely easy to embed (fully documented, no dependencies,
28
+ autoconf supported but optional).
29
+ - very small codebase, no bloated library, simple code.
29
30
  - fully extensible by being able to plug into the event loop,
30
31
  integrate other event loops, integrate other event loop users.
31
32
  - very little memory use (small watchers, small event loop data).
32
33
  - optional C++ interface allowing method and function callbacks
33
34
  at no extra memory or runtime overhead.
34
35
  - optional Perl interface with similar characteristics (capable
35
- of running Glib/Gtk2 on libev, interfaces with Net::SNMP and
36
- libadns).
36
+ of running Glib/Gtk2 on libev).
37
37
  - support for other languages (multiple C++ interfaces, D, Ruby,
38
38
  Python) available from third-parties.
39
39
 
40
- Examples of programs that embed libev: the EV perl module,
41
- rxvt-unicode, gvpe (GNU Virtual Private Ethernet), the Deliantra MMORPG
42
- server (http://www.deliantra.net/), Rubinius (a next-generation Ruby
43
- VM), the Ebb web server, the Rev event toolkit.
40
+ Examples of programs that embed libev: the EV perl module, node.js,
41
+ auditd, rxvt-unicode, gvpe (GNU Virtual Private Ethernet), the
42
+ Deliantra MMORPG server (http://www.deliantra.net/), Rubinius (a
43
+ next-generation Ruby VM), the Ebb web server, the Rev event toolkit.
44
44
 
45
45
 
46
46
  CONTRIBUTORS