nio4r 2.5.4 → 2.7.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (49) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/workflow.yml +34 -16
  3. data/.mailmap +16 -0
  4. data/Gemfile +5 -5
  5. data/{CHANGES.md → changes.md} +54 -0
  6. data/examples/echo_server.rb +7 -0
  7. data/ext/libev/Changes +71 -2
  8. data/ext/libev/ev.c +611 -198
  9. data/ext/libev/ev.h +25 -22
  10. data/ext/libev/ev_epoll.c +16 -14
  11. data/ext/libev/ev_iouring.c +694 -0
  12. data/ext/libev/ev_kqueue.c +4 -4
  13. data/ext/libev/ev_linuxaio.c +78 -100
  14. data/ext/libev/ev_poll.c +6 -6
  15. data/ext/libev/ev_port.c +3 -3
  16. data/ext/libev/ev_select.c +6 -6
  17. data/ext/libev/ev_vars.h +34 -0
  18. data/ext/libev/ev_win32.c +2 -2
  19. data/ext/libev/ev_wrap.h +56 -0
  20. data/ext/nio4r/bytebuffer.c +75 -38
  21. data/ext/nio4r/extconf.rb +24 -1
  22. data/ext/nio4r/monitor.c +47 -22
  23. data/ext/nio4r/nio4r.h +1 -5
  24. data/ext/nio4r/org/nio4r/ByteBuffer.java +2 -0
  25. data/ext/nio4r/org/nio4r/Monitor.java +1 -0
  26. data/ext/nio4r/org/nio4r/Selector.java +8 -10
  27. data/ext/nio4r/selector.c +88 -48
  28. data/lib/nio/bytebuffer.rb +6 -0
  29. data/lib/nio/monitor.rb +7 -0
  30. data/lib/nio/selector.rb +26 -9
  31. data/lib/nio/version.rb +6 -1
  32. data/lib/nio.rb +29 -1
  33. data/lib/nio4r.rb +5 -0
  34. data/license.md +77 -0
  35. data/nio4r.gemspec +4 -3
  36. data/rakelib/extension.rake +1 -2
  37. data/readme.md +91 -0
  38. data/spec/nio/acceptables_spec.rb +4 -0
  39. data/spec/nio/bytebuffer_spec.rb +6 -0
  40. data/spec/nio/monitor_spec.rb +7 -0
  41. data/spec/nio/selectables/pipe_spec.rb +6 -0
  42. data/spec/nio/selectables/ssl_socket_spec.rb +8 -3
  43. data/spec/nio/selectables/tcp_socket_spec.rb +7 -0
  44. data/spec/nio/selectables/udp_socket_spec.rb +7 -0
  45. data/spec/nio/selector_spec.rb +16 -0
  46. data/spec/spec_helper.rb +7 -2
  47. data/spec/support/selectable_examples.rb +8 -0
  48. metadata +14 -9
  49. data/README.md +0 -132
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3353e688cab0a1d45f509edcb0a5bc5fa3beb6faca9e6e5703fe75ecbb220ed9
4
- data.tar.gz: d5186d282adfa316128165ca4d2ccae5322a0605b15508d47170f9f7517e3346
3
+ metadata.gz: ae8b5e59a799c0161b454b1e4dcd97becc5bdb0b835ec6becf2a3a4488b648b5
4
+ data.tar.gz: e5b186044e74c4ad7c3b9846d6244dd21938b831eb415eccb63a781a4ee5dc9e
5
5
  SHA512:
6
- metadata.gz: 05c2472803019de225a4d813f302bad6810fecf193adad4291c4b58e0e5aaa34d02b60945bc6641be55103324b82eee001988641d2b9937f63d18e7d00a03f8d
7
- data.tar.gz: fcbb1f1aa622df5e82df481e40567c153d15ca2e59ca21fbd3aff00006326e1f8ec44ff108c59fc8e8124bcc3b8e99f23d6291fe7ca27092d7af6ac22be71eb5
6
+ metadata.gz: c22f5d7466ede134956ab01ea87c4554ce38a950019519f0a7c4a9f16cbe81c5a338de488d885761bd49393cfd72bf20a857204db13b051d6f59f8e5bc52bc1d
7
+ data.tar.gz: 27152f810d81a2f94b7428a3662e991441adb4756e24cb09753addd8d00b1a3a6ea80a2e89580eac76ab5d3328fa368cb43147ccaa9432d70e74a771ce22c863
@@ -14,30 +14,48 @@ jobs:
14
14
  strategy:
15
15
  fail-fast: false
16
16
  matrix:
17
- os: [ubuntu-16.04, ubuntu-18.04, macos-latest, windows-latest]
18
- ruby: [2.4, 2.5, 2.6, 2.7, jruby, truffleruby-head]
17
+ os:
18
+ - ubuntu-22.04
19
+ - macos-11
20
+ - windows-2022
21
+ ruby:
22
+ - "2.4"
23
+ - "2.5"
24
+ - "2.6"
25
+ - "2.7"
26
+ - "3.0"
27
+ - "3.1"
28
+ - "3.2"
29
+ - "head"
30
+ - "jruby"
31
+ - "truffleruby"
32
+ include:
33
+ - {os: ubuntu-20.04, ruby: "3.2"}
34
+ - {os: windows-2019, ruby: "3.2"}
35
+ - {os: windows-2022, ruby: ucrt}
19
36
  exclude:
20
- - { os: windows-latest, ruby: jruby }
21
- - { os: windows-latest, ruby: truffleruby-head }
37
+ - {os: windows-2022, ruby: head}
38
+ - {os: windows-2022, ruby: jruby}
39
+ - {os: windows-2022, ruby: truffleruby}
22
40
 
23
41
  steps:
24
- - name: repo checkout
25
- uses: actions/checkout@v2
42
+ - uses: actions/checkout@v3
26
43
 
27
- - name: load ruby
28
- uses: ruby/setup-ruby@v1
44
+ - name: set JAVA_HOME
45
+ if: |
46
+ startsWith(matrix.ruby, 'jruby')
47
+ shell: bash
48
+ run: |
49
+ echo JAVA_HOME=$JAVA_HOME_11_X64 >> $GITHUB_ENV
50
+
51
+ - uses: ruby/setup-ruby@v1
29
52
  with:
30
53
  ruby-version: ${{matrix.ruby}}
54
+ bundler-cache: true
31
55
 
32
- - name: RubyGems, Bundler Update
33
- run: gem update --system --no-document --conservative
34
-
35
- - name: bundle install
36
- run: bundle install --path .bundle/gems --without development
37
-
38
- - name: compile
56
+ - name: Compile
39
57
  run: bundle exec rake compile
40
58
 
41
- - name: test
59
+ - name: Test
42
60
  run: bundle exec rake spec
43
61
  timeout-minutes: 10
data/.mailmap ADDED
@@ -0,0 +1,16 @@
1
+ Sadayuki Furuhashi <frsyuki@users.sourceforge.jp>
2
+ Shannon Skipper <shannonskipper@gmail.com>
3
+ Anatol Pomozov <anatol.pomozov@gmail.com>
4
+ Hiroshi Shibata <shibata.hiroshi@gmail.com>
5
+ John Thornton <ubergeek3141@gmail.com>
6
+ Upekshe Jayasekera <usmj000@gmail.com>
7
+ Upekshe Jayasekera <upekshej.11@cse.mrt.ac.lk>
8
+ Usaku Nakamura <usa@garbagecollect.jp>
9
+ Tomoya Ishida <tomoyapenguin@gmail.com>
10
+ Tiago Cardoso <cardoso_tiago@hotmail.com>
11
+ Ravil Bayramgalin <brainopia@evilmartians.com>
12
+ Gregory Longtin <Greg.mpls@gmail.com>
13
+ Gregory Longtin <Greg.mpls@gmail.com> <MSP-Greg@users.noreply.github.com>
14
+ Elad Eyal <elad.eyal@intel.com>
15
+ Boaz Segev <bo@bowild.com>
16
+ Tao Luo <luotao.ruby@gmail.com>
data/Gemfile CHANGED
@@ -6,14 +6,14 @@ gemspec
6
6
 
7
7
  gem "jruby-openssl" if defined? JRUBY_VERSION
8
8
 
9
- group :development do
10
- gem "guard-rspec", require: false
11
- gem "pry", require: false
9
+ group :maintenance, optional: true do
10
+ gem "bake"
11
+ gem "bake-gem"
12
+ # gem "bake-modernize"
12
13
  end
13
14
 
14
15
  group :development, :test do
15
- gem "coveralls", require: false
16
- gem "rake-compiler", require: false
16
+ gem "rake-compiler", "~> 1.1.9", require: false
17
17
  gem "rspec", "~> 3.7", require: false
18
18
  gem "rubocop", "0.82.0", require: false
19
19
  end
@@ -1,3 +1,54 @@
1
+ ## 2.6.2
2
+
3
+ * Convert NIO objects to TypedData API.
4
+
5
+ ## 2.6.1
6
+
7
+ * Don't update `io` which is subsequently stored. Retain the original.
8
+
9
+ ## 2.6.0
10
+
11
+ * Fix conversion loses int precision.
12
+ * Avoid direct access to IO internals.
13
+ * Resolve issue loading both nio and nio4r gems.
14
+
15
+ ## 2.5.9 (2023-04-02)
16
+
17
+ https://github.com/socketry/nio4r/compare/v2.5.8..v2.5.9
18
+
19
+ ## 2.5.8 (2021-08-03)
20
+
21
+ * [#276](https://github.com/socketry/nio4r/pull/276)
22
+ Fix missing return statement in function returning non-void (issue [#275](https://github.com/socketry/nio4r/pull/275))
23
+ ([@ioquatix])
24
+ * Remove `guard-rspec` from development dependencies ([@ioquatix])
25
+
26
+ ## 2.5.7 (2021-03-04)
27
+
28
+ * [#267](https://github.com/socketry/nio4r/pull/267)
29
+ Don't try to link universal extension
30
+ ([@ioquatix])
31
+
32
+ ## 2.5.6 (2021-03-04)
33
+
34
+ * [#268](https://github.com/socketry/nio4r/pull/268)
35
+ Prefer kqueue when on OSX >= v10.12.2
36
+ ([@jcmfernandes])
37
+
38
+ ## 2.5.5 (2021-02-05)
39
+
40
+ * [#256](https://github.com/socketry/nio4r/pull/256)
41
+ Use libev 4.33, featuring experimental `io_uring` support.
42
+ ([@jcmfernandes])
43
+
44
+ * [#260](https://github.com/socketry/nio4r/pull/260)
45
+ Workaround for ARM-based macOS Ruby: Use pure Ruby for M1, since the native extension is crashing on M1 (arm64).
46
+ ([@jasl])
47
+
48
+ * [#252](https://github.com/socketry/nio4r/pull/252)
49
+ JRuby: Fix javac -Xlint warnings
50
+ ([@headius])
51
+
1
52
  ## 2.5.4 (2020-09-16)
2
53
 
3
54
  * [#251](https://github.com/socketry/nio4r/issues/251)
@@ -265,3 +316,6 @@ Possible bug with Ruby >= 2.7.0 and `GC.compact`
265
316
  [@eregon]: https://github.com/eregon
266
317
  [@olleolleolle]: https://github.com/olleolleolle
267
318
  [@boazsegev]: https://github.com/boazsegev
319
+ [@headius]: https://github.com/headius
320
+ [@jasl]: https://github.com/jasl
321
+ [@jcmfernandes]: https://github.com/jcmfernandes
@@ -1,6 +1,13 @@
1
1
  #!/usr/bin/env ruby
2
2
  # frozen_string_literal: true
3
3
 
4
+ # Released under the MIT License.
5
+ # Copyright, 2012-2016, by Tony Arcieri.
6
+ # Copyright, 2016, by Jun Aruga.
7
+ # Copyright, 2019, by Zhang Kang.
8
+ # Copyright, 2020, by Thomas Dziedzic.
9
+ # Copyright, 2023, by Samuel Williams.
10
+
4
11
  $LOAD_PATH.push File.expand_path("../lib", __dir__)
5
12
  require "nio"
6
13
  require "socket"
data/ext/libev/Changes CHANGED
@@ -1,8 +1,77 @@
1
1
  Revision history for libev, a high-performance and full-featured event loop.
2
2
 
3
+ TODO: for next ABI/API change, consider moving EV__IOFDSSET into io->fd instead and provide a getter.
4
+ TODO: document EV_TSTAMP_T
5
+
6
+ 4.33 Wed Mar 18 13:22:29 CET 2020
7
+ - no changes w.r.t. 4.32.
8
+
9
+ 4.32 (EV only)
10
+ - the 4.31 timerfd code wrongly changed the priority of the signal
11
+ fd watcher, which is usually harmless unless signal fds are
12
+ also used (found via cpan tester service).
13
+ - the documentation wrongly claimed that user may modify fd and events
14
+ members in io watchers when the watcher was stopped
15
+ (found by b_jonas).
16
+ - new ev_io_modify mutator which changes only the events member,
17
+ which can be faster. also added ev::io::set (int events) method
18
+ to ev++.h.
19
+ - officially allow a zero events mask for io watchers. this should
20
+ work with older libev versions as well but was not officially
21
+ allowed before.
22
+ - do not wake up every minute when timerfd is used to detect timejumps.
23
+ - do not wake up every minute when periodics are disabled and we have
24
+ a monotonic clock.
25
+ - support a lot more "uncommon" compile time configurations,
26
+ such as ev_embed enabled but ev_timer disabled.
27
+ - use a start/stop wrapper class to reduce code duplication in
28
+ ev++.h and make it needlessly more c++-y.
29
+ - the linux aio backend is no longer compiled in by default.
30
+ - update to libecb version 0x00010008.
31
+
32
+ 4.31 Fri Dec 20 21:58:29 CET 2019
33
+ - handle backends with minimum wait time a bit better by not
34
+ waiting in the presence of already-expired timers
35
+ (behaviour reported by Felipe Gasper).
36
+ - new feature: use timerfd to detect timejumps quickly,
37
+ can be disabled with the new EVFLAG_NOTIMERFD loop flag.
38
+ - document EV_USE_SIGNALFD feature macro.
39
+
40
+ 4.30 (EV only)
41
+ - change non-autoconf test for __kernel_rwf_t by testing
42
+ LINUX_VERSION_CODE, the most direct test I could find.
43
+ - fix a bug in the io_uring backend that polled the wrong
44
+ backend fd, causing it to not work in many cases.
45
+
46
+ 4.29 (EV only)
47
+ - add io uring autoconf and non-autoconf detection.
48
+ - disable io_uring when some header files are too old.
49
+
50
+ 4.28 (EV only)
51
+ - linuxaio backend resulted in random memory corruption
52
+ when loop is forked.
53
+ - linuxaio backend might have tried to cancel an iocb
54
+ multiple times (was unable to trigger this).
55
+ - linuxaio backend now employs a generation counter to
56
+ avoid handling spurious events from cancelled requests.
57
+ - io_cancel can return EINTR, deal with it. also, assume
58
+ io_submit also returns EINTR.
59
+ - fix some other minor bugs in linuxaio backend.
60
+ - ev_tstamp type can now be overriden by defining EV_TSTAMP_T.
61
+ - cleanup: replace expect_true/false and noinline by their
62
+ libecb counterparts.
63
+ - move syscall infrastructure from ev_linuxaio.c to ev.c.
64
+ - prepare io_uring integration.
65
+ - tweak ev_floor.
66
+ - epoll, poll, win32 Sleep and other places that use millisecond
67
+ reslution now all try to round up times.
68
+ - solaris port backend didn't compile.
69
+ - abstract time constants into their macros, for more flexibility.
70
+
3
71
  4.27 Thu Jun 27 22:43:44 CEST 2019
4
- - linux aio backend almost complete rewritten to work around its
72
+ - linux aio backend almost completely rewritten to work around its
5
73
  limitations.
74
+ - linux aio backend now requires linux 4.19+.
6
75
  - epoll backend now mandatory for linux aio backend.
7
76
  - fail assertions more aggressively on invalid fd's detected
8
77
  in the event loop, do not just silently fd_kill in case of
@@ -22,7 +91,7 @@ Revision history for libev, a high-performance and full-featured event loop.
22
91
  4.25 Fri Dec 21 07:49:20 CET 2018
23
92
  - INCOMPATIBLE CHANGE: EV_THROW was renamed to EV_NOEXCEPT
24
93
  (EV_THROW still provided) and now uses noexcept on C++11 or newer.
25
- - move the darwin select workaround highe rin ev.c, as newer versions of
94
+ - move the darwin select workaround higher in ev.c, as newer versions of
26
95
  darwin managed to break their broken select even more.
27
96
  - ANDROID => __ANDROID__ (reported by enh@google.com).
28
97
  - disable epoll_create1 on android because it has broken header files