nio4r 2.5.2 → 2.7.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.
- checksums.yaml +4 -4
- data/.github/workflows/workflow.yml +61 -0
- data/.mailmap +16 -0
- data/.rubocop.yml +30 -11
- data/Gemfile +6 -6
- data/{CHANGES.md → changes.md} +78 -1
- data/examples/echo_server.rb +9 -2
- data/ext/libev/Changes +71 -2
- data/ext/libev/ev.c +611 -198
- data/ext/libev/ev.h +25 -22
- data/ext/libev/ev_epoll.c +16 -14
- data/ext/libev/ev_iouring.c +694 -0
- data/ext/libev/ev_kqueue.c +4 -4
- data/ext/libev/ev_linuxaio.c +78 -100
- data/ext/libev/ev_poll.c +6 -6
- data/ext/libev/ev_port.c +3 -3
- data/ext/libev/ev_select.c +6 -6
- data/ext/libev/ev_vars.h +34 -0
- data/ext/libev/ev_win32.c +2 -2
- data/ext/libev/ev_wrap.h +56 -0
- data/ext/nio4r/.clang-format +16 -0
- data/ext/nio4r/bytebuffer.c +101 -65
- data/ext/nio4r/extconf.rb +26 -0
- data/ext/nio4r/libev.h +1 -3
- data/ext/nio4r/monitor.c +81 -53
- data/ext/nio4r/nio4r.h +6 -15
- data/ext/nio4r/nio4r_ext.c +1 -1
- data/ext/nio4r/org/nio4r/ByteBuffer.java +2 -0
- data/ext/nio4r/org/nio4r/Monitor.java +1 -0
- data/ext/nio4r/org/nio4r/Selector.java +8 -10
- data/ext/nio4r/selector.c +132 -93
- data/lib/nio/bytebuffer.rb +10 -0
- data/lib/nio/monitor.rb +8 -1
- data/lib/nio/selector.rb +27 -10
- data/lib/nio/version.rb +6 -1
- data/lib/nio.rb +29 -1
- data/lib/nio4r.rb +5 -0
- data/license.md +77 -0
- data/nio4r.gemspec +6 -5
- data/rakelib/extension.rake +1 -2
- data/readme.md +91 -0
- data/spec/nio/acceptables_spec.rb +4 -0
- data/spec/nio/bytebuffer_spec.rb +6 -1
- data/spec/nio/monitor_spec.rb +7 -0
- data/spec/nio/selectables/pipe_spec.rb +6 -0
- data/spec/nio/selectables/ssl_socket_spec.rb +7 -0
- data/spec/nio/selectables/tcp_socket_spec.rb +7 -0
- data/spec/nio/selectables/udp_socket_spec.rb +9 -2
- data/spec/nio/selector_spec.rb +16 -1
- data/spec/spec_helper.rb +7 -2
- data/spec/support/selectable_examples.rb +8 -0
- metadata +20 -16
- data/.travis.yml +0 -44
- data/Guardfile +0 -10
- data/README.md +0 -150
- data/appveyor.yml +0 -40
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ae8b5e59a799c0161b454b1e4dcd97becc5bdb0b835ec6becf2a3a4488b648b5
|
4
|
+
data.tar.gz: e5b186044e74c4ad7c3b9846d6244dd21938b831eb415eccb63a781a4ee5dc9e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c22f5d7466ede134956ab01ea87c4554ce38a950019519f0a7c4a9f16cbe81c5a338de488d885761bd49393cfd72bf20a857204db13b051d6f59f8e5bc52bc1d
|
7
|
+
data.tar.gz: 27152f810d81a2f94b7428a3662e991441adb4756e24cb09753addd8d00b1a3a6ea80a2e89580eac76ab5d3328fa368cb43147ccaa9432d70e74a771ce22c863
|
@@ -0,0 +1,61 @@
|
|
1
|
+
name: nio4r
|
2
|
+
|
3
|
+
on: [push, pull_request]
|
4
|
+
|
5
|
+
jobs:
|
6
|
+
build:
|
7
|
+
name: >-
|
8
|
+
${{matrix.os}}, ${{matrix.ruby}}
|
9
|
+
env:
|
10
|
+
CI: true
|
11
|
+
TESTOPTS: -v
|
12
|
+
|
13
|
+
runs-on: ${{matrix.os}}
|
14
|
+
strategy:
|
15
|
+
fail-fast: false
|
16
|
+
matrix:
|
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}
|
36
|
+
exclude:
|
37
|
+
- {os: windows-2022, ruby: head}
|
38
|
+
- {os: windows-2022, ruby: jruby}
|
39
|
+
- {os: windows-2022, ruby: truffleruby}
|
40
|
+
|
41
|
+
steps:
|
42
|
+
- uses: actions/checkout@v3
|
43
|
+
|
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
|
52
|
+
with:
|
53
|
+
ruby-version: ${{matrix.ruby}}
|
54
|
+
bundler-cache: true
|
55
|
+
|
56
|
+
- name: Compile
|
57
|
+
run: bundle exec rake compile
|
58
|
+
|
59
|
+
- name: Test
|
60
|
+
run: bundle exec rake spec
|
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/.rubocop.yml
CHANGED
@@ -1,23 +1,40 @@
|
|
1
1
|
AllCops:
|
2
|
-
TargetRubyVersion: 2.
|
2
|
+
TargetRubyVersion: 2.4
|
3
3
|
DisplayCopNames: true
|
4
4
|
|
5
|
+
Layout/HashAlignment:
|
6
|
+
Enabled: false
|
7
|
+
|
8
|
+
Layout/LineLength:
|
9
|
+
Max: 128
|
10
|
+
|
11
|
+
Layout/SpaceAroundMethodCallOperator:
|
12
|
+
Enabled: false
|
13
|
+
|
5
14
|
Layout/SpaceInsideBlockBraces:
|
6
15
|
Enabled: false
|
7
16
|
|
8
17
|
Style/IfUnlessModifier:
|
9
18
|
Enabled: false
|
10
19
|
|
20
|
+
Style/UnpackFirst:
|
21
|
+
Enabled: false
|
22
|
+
|
11
23
|
#
|
12
24
|
# Lint
|
13
25
|
#
|
14
26
|
|
15
|
-
Lint/
|
27
|
+
Lint/SuppressedException:
|
16
28
|
Enabled: false
|
17
29
|
|
18
30
|
Lint/Loop:
|
19
31
|
Enabled: false
|
20
32
|
|
33
|
+
Lint/RaiseException:
|
34
|
+
Enabled: false
|
35
|
+
|
36
|
+
Lint/StructNewOverride:
|
37
|
+
Enabled: false
|
21
38
|
#
|
22
39
|
# Metrics
|
23
40
|
#
|
@@ -32,9 +49,6 @@ Metrics/BlockLength:
|
|
32
49
|
Metrics/ClassLength:
|
33
50
|
Max: 128
|
34
51
|
|
35
|
-
Metrics/LineLength:
|
36
|
-
Max: 128
|
37
|
-
|
38
52
|
Metrics/MethodLength:
|
39
53
|
CountComments: false
|
40
54
|
Max: 50
|
@@ -46,16 +60,12 @@ Metrics/PerceivedComplexity:
|
|
46
60
|
Max: 15
|
47
61
|
|
48
62
|
#
|
49
|
-
#
|
63
|
+
# Style
|
50
64
|
#
|
51
65
|
|
52
|
-
|
66
|
+
Style/ExponentialNotation:
|
53
67
|
Enabled: false
|
54
68
|
|
55
|
-
#
|
56
|
-
# Style
|
57
|
-
#
|
58
|
-
|
59
69
|
Style/FormatStringToken:
|
60
70
|
Enabled: false
|
61
71
|
|
@@ -65,6 +75,15 @@ Style/FrozenStringLiteralComment:
|
|
65
75
|
Style/GlobalVars:
|
66
76
|
Enabled: false
|
67
77
|
|
78
|
+
Style/HashEachMethods:
|
79
|
+
Enabled: false
|
80
|
+
|
81
|
+
Style/HashTransformKeys:
|
82
|
+
Enabled: false
|
83
|
+
|
84
|
+
Style/HashTransformValues:
|
85
|
+
Enabled: false
|
86
|
+
|
68
87
|
Style/NumericPredicate:
|
69
88
|
Enabled: false
|
70
89
|
|
data/Gemfile
CHANGED
@@ -6,14 +6,14 @@ gemspec
|
|
6
6
|
|
7
7
|
gem "jruby-openssl" if defined? JRUBY_VERSION
|
8
8
|
|
9
|
-
group :
|
10
|
-
gem "
|
11
|
-
gem "
|
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 "
|
16
|
-
gem "rake-compiler", require: false
|
16
|
+
gem "rake-compiler", "~> 1.1.9", require: false
|
17
17
|
gem "rspec", "~> 3.7", require: false
|
18
|
-
gem "rubocop", "0.
|
18
|
+
gem "rubocop", "0.82.0", require: false
|
19
19
|
end
|
data/{CHANGES.md → changes.md}
RENAMED
@@ -1,3 +1,76 @@
|
|
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
|
+
|
52
|
+
## 2.5.4 (2020-09-16)
|
53
|
+
|
54
|
+
* [#251](https://github.com/socketry/nio4r/issues/251)
|
55
|
+
Intermittent SEGV during GC.
|
56
|
+
([@boazsegev])
|
57
|
+
|
58
|
+
## 2.5.3 (2020-09-07)
|
59
|
+
|
60
|
+
* [#241](https://github.com/socketry/nio4r/issues/241)
|
61
|
+
Possible bug with Ruby >= 2.7.0 and `GC.compact`.
|
62
|
+
([@boazsegev])
|
63
|
+
|
64
|
+
## 2.5.2 (2019-09-24)
|
65
|
+
|
66
|
+
* [#220](https://github.com/socketry/nio4r/issues/220)
|
67
|
+
Update to libev-4.27 & fix assorted warnings.
|
68
|
+
([@ioquatix])
|
69
|
+
|
70
|
+
* [#225](https://github.com/socketry/nio4r/issues/225)
|
71
|
+
Avoid need for linux headers.
|
72
|
+
([@ioquatix])
|
73
|
+
|
1
74
|
## 2.4.0 (2019-07-07)
|
2
75
|
|
3
76
|
* [#211](https://github.com/socketry/nio4r/pull/211)
|
@@ -9,7 +82,7 @@
|
|
9
82
|
|
10
83
|
* Assorted fixes for TruffleRuby & JRuby.
|
11
84
|
([@eregon], [@olleolleolle])
|
12
|
-
|
85
|
+
Possible bug with Ruby >= 2.7.0 and `GC.compact`
|
13
86
|
* Update libev to v4.25.
|
14
87
|
([@ioquatix])
|
15
88
|
|
@@ -242,3 +315,7 @@
|
|
242
315
|
[@ioquatix]: https://github.com/ioquatix
|
243
316
|
[@eregon]: https://github.com/eregon
|
244
317
|
[@olleolleolle]: https://github.com/olleolleolle
|
318
|
+
[@boazsegev]: https://github.com/boazsegev
|
319
|
+
[@headius]: https://github.com/headius
|
320
|
+
[@jasl]: https://github.com/jasl
|
321
|
+
[@jcmfernandes]: https://github.com/jcmfernandes
|
data/examples/echo_server.rb
CHANGED
@@ -1,7 +1,14 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
# frozen_string_literal: true
|
3
3
|
|
4
|
-
|
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
|
+
|
11
|
+
$LOAD_PATH.push File.expand_path("../lib", __dir__)
|
5
12
|
require "nio"
|
6
13
|
require "socket"
|
7
14
|
|
@@ -19,7 +26,7 @@ class EchoServer
|
|
19
26
|
|
20
27
|
def run
|
21
28
|
loop do
|
22
|
-
@selector.select { |monitor| monitor.value.call
|
29
|
+
@selector.select { |monitor| monitor.value.call }
|
23
30
|
end
|
24
31
|
end
|
25
32
|
|
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
|
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
|
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
|