nio4r 2.5.2 → 2.7.0
Sign up to get free protection for your applications and to get access to all the features.
- 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
data/lib/nio.rb
CHANGED
@@ -1,5 +1,14 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
# Released under the MIT License.
|
4
|
+
# Copyright, 2011-2017, by Tony Arcieri.
|
5
|
+
# Copyright, 2013, by Stephen von Takach.
|
6
|
+
# Copyright, 2013, by Per Lundberg.
|
7
|
+
# Copyright, 2014, by Marek Kowalcze.
|
8
|
+
# Copyright, 2016, by Upekshe Jayasekera.
|
9
|
+
# Copyright, 2019-2023, by Samuel Williams.
|
10
|
+
# Copyright, 2021, by Jun Jiang.
|
11
|
+
|
3
12
|
require "socket"
|
4
13
|
require "nio/version"
|
5
14
|
|
@@ -12,9 +21,28 @@ module NIO
|
|
12
21
|
def self.engine
|
13
22
|
ENGINE
|
14
23
|
end
|
24
|
+
|
25
|
+
def self.pure?(env = ENV)
|
26
|
+
# The user has explicitly opted in to non-native implementation:
|
27
|
+
if env["NIO4R_PURE"] == "true"
|
28
|
+
return true
|
29
|
+
end
|
30
|
+
|
31
|
+
# Native Ruby on Windows is not supported:
|
32
|
+
if (Gem.win_platform? && !defined?(JRUBY_VERSION))
|
33
|
+
return true
|
34
|
+
end
|
35
|
+
|
36
|
+
# M1 native extension is crashing on M1 (arm64):
|
37
|
+
# if RUBY_PLATFORM =~ /darwin/ && RUBY_PLATFORM =~ /arm64/
|
38
|
+
# return true
|
39
|
+
# end
|
40
|
+
|
41
|
+
return false
|
42
|
+
end
|
15
43
|
end
|
16
44
|
|
17
|
-
if
|
45
|
+
if NIO.pure?
|
18
46
|
require "nio/monitor"
|
19
47
|
require "nio/selector"
|
20
48
|
require "nio/bytebuffer"
|
data/lib/nio4r.rb
ADDED
data/license.md
ADDED
@@ -0,0 +1,77 @@
|
|
1
|
+
# MIT License
|
2
|
+
|
3
|
+
Copyright, 2011-2020, by Tony Arcieri.
|
4
|
+
Copyright, 2012, by Bernd Ahlers.
|
5
|
+
Copyright, 2012, by Logan Bowers.
|
6
|
+
Copyright, 2012, by Dirkjan Bussink.
|
7
|
+
Copyright, 2013, by Sadayuki Furuhashi.
|
8
|
+
Copyright, 2013, by Shannon Skipper.
|
9
|
+
Copyright, 2013, by Stephen von Takach.
|
10
|
+
Copyright, 2013, by Tim Carey-Smith.
|
11
|
+
Copyright, 2013, by Per Lundberg.
|
12
|
+
Copyright, 2013, by Ravil Bayramgalin.
|
13
|
+
Copyright, 2013, by Luis Lavena.
|
14
|
+
Copyright, 2014, by Anatol Pomozov.
|
15
|
+
Copyright, 2014, by Hiroshi Shibata.
|
16
|
+
Copyright, 2014, by Marek Kowalcze.
|
17
|
+
Copyright, 2014, by Sergey Avseyev.
|
18
|
+
Copyright, 2014, by John Thornton.
|
19
|
+
Copyright, 2015-2017, by Tiago Cardoso.
|
20
|
+
Copyright, 2015, by Daniel Berger.
|
21
|
+
Copyright, 2015-2016, by Upekshe Jayasekera.
|
22
|
+
Copyright, 2015, by Vladimir Kochnev.
|
23
|
+
Copyright, 2016-2018, by Jun Aruga.
|
24
|
+
Copyright, 2016, by Omer Katz.
|
25
|
+
Copyright, 2016, by Denis Washington.
|
26
|
+
Copyright, 2016-2021, by Olle Jonsson.
|
27
|
+
Copyright, 2017, by Tao Luo.
|
28
|
+
Copyright, 2017, by Usaku Nakamura.
|
29
|
+
Copyright, 2017-2022, by Gregory Longtin.
|
30
|
+
Copyright, 2017, by Lars Kanis.
|
31
|
+
Copyright, 2017, by Tomoya Ishida.
|
32
|
+
Copyright, 2018-2023, by Samuel Williams.
|
33
|
+
Copyright, 2019, by Cédric Boutillier.
|
34
|
+
Copyright, 2019-2020, by Benoit Daloze.
|
35
|
+
Copyright, 2019, by Jesús Burgos Maciá.
|
36
|
+
Copyright, 2019, by Thomas Kuntz.
|
37
|
+
Copyright, 2019, by Orien Madgwick.
|
38
|
+
Copyright, 2019, by Zhang Kang.
|
39
|
+
Copyright, 2020, by Thomas Dziedzic.
|
40
|
+
Copyright, 2020, by Elad Eyal.
|
41
|
+
Copyright, 2020, by Pedro Paiva.
|
42
|
+
Copyright, 2020, by Boaz Segev.
|
43
|
+
Copyright, 2020, by Charles Oliver Nutter.
|
44
|
+
Copyright, 2020-2021, by Joao Fernandes.
|
45
|
+
Copyright, 2021, by Jun Jiang.
|
46
|
+
Copyright, 2021, by Pavel Lobashov.
|
47
|
+
Copyright, 2021, by Jeffrey Martin.
|
48
|
+
Copyright, 2023, by Pavel Rosický.
|
49
|
+
Copyright, 2023, by Tsimnuj Hawj.
|
50
|
+
Copyright, 2023, by Phillip Aldridge.
|
51
|
+
|
52
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
53
|
+
of this software and associated documentation files (the "Software"), to deal
|
54
|
+
in the Software without restriction, including without limitation the rights
|
55
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
56
|
+
copies of the Software, and to permit persons to whom the Software is
|
57
|
+
furnished to do so, subject to the following conditions:
|
58
|
+
|
59
|
+
The above copyright notice and this permission notice shall be included in all
|
60
|
+
copies or substantial portions of the Software.
|
61
|
+
|
62
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
63
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
64
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
65
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
66
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
67
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
68
|
+
SOFTWARE.
|
69
|
+
|
70
|
+
## libev
|
71
|
+
|
72
|
+
Released under the BSD-2-Clause OR GPL-2.0-or-later license.
|
73
|
+
See [ext/libev/LICENSE] for details.
|
74
|
+
|
75
|
+
Copyright, 2007-2019, by Marc Alexander Lehmann.
|
76
|
+
|
77
|
+
[ext/libev/LICENSE]: https://github.com/socketry/nio4r/blob/master/ext/libev/LICENSE
|
data/nio4r.gemspec
CHANGED
@@ -1,12 +1,12 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require File.expand_path("
|
3
|
+
require File.expand_path("lib/nio/version", __dir__)
|
4
4
|
|
5
5
|
Gem::Specification.new do |spec|
|
6
6
|
spec.authors = ["Tony Arcieri"]
|
7
7
|
spec.email = ["bascule@gmail.com"]
|
8
8
|
spec.homepage = "https://github.com/socketry/nio4r"
|
9
|
-
spec.license = "MIT"
|
9
|
+
spec.license = "MIT AND (BSD-2-Clause OR GPL-2.0-or-later)"
|
10
10
|
spec.summary = "New IO for Ruby"
|
11
11
|
spec.description = <<-DESCRIPTION.strip.gsub(/\s+/, " ")
|
12
12
|
Cross-platform asynchronous I/O primitives for scalable network clients
|
@@ -22,13 +22,14 @@ Gem::Specification.new do |spec|
|
|
22
22
|
|
23
23
|
spec.metadata = {
|
24
24
|
"bug_tracker_uri" => "https://github.com/socketry/nio4r/issues",
|
25
|
-
"changelog_uri" => "https://github.com/socketry/nio4r/blob/
|
25
|
+
"changelog_uri" => "https://github.com/socketry/nio4r/blob/main/changes.md",
|
26
26
|
"documentation_uri" => "https://www.rubydoc.info/gems/nio4r/#{spec.version}",
|
27
27
|
"source_code_uri" => "https://github.com/socketry/nio4r/tree/v#{spec.version}",
|
28
|
-
"wiki_uri" => "https://github.com/socketry/nio4r/wiki"
|
28
|
+
"wiki_uri" => "https://github.com/socketry/nio4r/wiki",
|
29
|
+
"funding_uri" => "https://github.com/sponsors/ioquatix/",
|
29
30
|
}
|
30
31
|
|
31
|
-
spec.required_ruby_version = ">= 2.
|
32
|
+
spec.required_ruby_version = ">= 2.4"
|
32
33
|
|
33
34
|
if defined? JRUBY_VERSION
|
34
35
|
spec.files << "lib/nio4r_ext.jar"
|
data/rakelib/extension.rake
CHANGED
data/readme.md
ADDED
@@ -0,0 +1,91 @@
|
|
1
|
+
# ![nio4r](https://raw.github.com/socketry/nio4r/master/logo.png)
|
2
|
+
|
3
|
+
[![Gem Version](https://badge.fury.io/rb/nio4r.svg)](http://rubygems.org/gems/nio4r)
|
4
|
+
[![Build Status](https://github.com/socketry/nio4r/workflows/nio4r/badge.svg?branch=master&event=push)](https://github.com/socketry/nio4r/actions?query=workflow:nio4r)
|
5
|
+
[![Code Climate](https://codeclimate.com/github/socketry/nio4r.svg)](https://codeclimate.com/github/socketry/nio4r)
|
6
|
+
[![Yard Docs](https://img.shields.io/badge/yard-docs-blue.svg)](http://www.rubydoc.info/gems/nio4r/2.2.0)
|
7
|
+
|
8
|
+
**New I/O for Ruby (nio4r)**: cross-platform asynchronous I/O primitives for
|
9
|
+
scalable network clients and servers. Modeled after the Java NIO API, but
|
10
|
+
simplified for ease-of-use.
|
11
|
+
|
12
|
+
**nio4r** provides an abstract, cross-platform stateful I/O selector API for Ruby.
|
13
|
+
I/O selectors are the heart of "reactor"-based event loops, and monitor
|
14
|
+
multiple I/O objects for various types of readiness, e.g. ready for reading or
|
15
|
+
writing.
|
16
|
+
|
17
|
+
## Projects using nio4r
|
18
|
+
|
19
|
+
- [ActionCable](https://rubygems.org/gems/actioncable): Rails 5 WebSocket protocol, uses nio4r for a WebSocket server
|
20
|
+
- [Celluloid](https://github.com/celluloid/celluloid-io): Actor-based concurrency framework, uses nio4r for async I/O
|
21
|
+
- [Async](https://github.com/socketry/async): Asynchronous I/O framework for Ruby
|
22
|
+
- [Puma](https://github.com/puma/puma): Ruby/Rack web server built for concurrency
|
23
|
+
|
24
|
+
## Goals
|
25
|
+
|
26
|
+
- Expose high-level interfaces for stateful IO selectors
|
27
|
+
- Keep the API small to maximize both portability and performance across many
|
28
|
+
different OSes and Ruby VMs
|
29
|
+
- Provide inherently thread-safe facilities for working with IO objects
|
30
|
+
|
31
|
+
## Supported platforms
|
32
|
+
|
33
|
+
- Ruby 2.4
|
34
|
+
- Ruby 2.5
|
35
|
+
- Ruby 2.6
|
36
|
+
- Ruby 2.7
|
37
|
+
- Ruby 3.0
|
38
|
+
- [JRuby](https://github.com/jruby/jruby)
|
39
|
+
- [TruffleRuby](https://github.com/oracle/truffleruby)
|
40
|
+
|
41
|
+
## Supported backends
|
42
|
+
|
43
|
+
- **libev**: MRI C extension targeting multiple native IO selector APIs (e.g epoll, kqueue)
|
44
|
+
- **Java NIO**: JRuby extension which wraps the Java NIO subsystem
|
45
|
+
- **Pure Ruby**: `Kernel.select`-based backend that should work on any Ruby interpreter
|
46
|
+
|
47
|
+
## Documentation
|
48
|
+
|
49
|
+
[Please see the nio4r wiki](https://github.com/socketry/nio4r/wiki)
|
50
|
+
for more detailed documentation and usage notes:
|
51
|
+
|
52
|
+
- [Getting Started](https://github.com/socketry/nio4r/wiki/Getting-Started): Introduction to nio4r's components
|
53
|
+
- [Selectors](https://github.com/socketry/nio4r/wiki/Selectors): monitor multiple `IO` objects for readiness events
|
54
|
+
- [Monitors](https://github.com/socketry/nio4r/wiki/Monitors): control interests and inspect readiness for specific `IO` objects
|
55
|
+
- [Byte Buffers](https://github.com/socketry/nio4r/wiki/Byte-Buffers): fixed-size native buffers for high-performance I/O
|
56
|
+
|
57
|
+
See also:
|
58
|
+
|
59
|
+
- [YARD API documentation](http://www.rubydoc.info/gems/nio4r/frames)
|
60
|
+
|
61
|
+
## Non-goals
|
62
|
+
|
63
|
+
**nio4r** is not a full-featured event framework like [EventMachine](https://github.com/eventmachine/eventmachine) or [Cool.io](https://coolio.github.io/).
|
64
|
+
Instead, nio4r is the sort of thing you might write a library like that on
|
65
|
+
top of. nio4r provides a minimal API such that individual Ruby implementers
|
66
|
+
may choose to produce optimized versions for their platform, without having
|
67
|
+
to maintain a large codebase.
|
68
|
+
|
69
|
+
## Releases
|
70
|
+
|
71
|
+
### CRuby
|
72
|
+
|
73
|
+
rake clean
|
74
|
+
rake release
|
75
|
+
|
76
|
+
### JRuby
|
77
|
+
|
78
|
+
You might need to delete `Gemfile.lock` before trying to `bundle install`.
|
79
|
+
|
80
|
+
# Ensure you have the correct JDK:
|
81
|
+
pacman -Syu jdk-openjdk
|
82
|
+
archlinux-java set java-19-openjdk
|
83
|
+
|
84
|
+
# Ensure you are using jruby:
|
85
|
+
chruby jruby
|
86
|
+
bundle update
|
87
|
+
|
88
|
+
# Build the package:
|
89
|
+
rake clean
|
90
|
+
rake compile
|
91
|
+
rake release
|
data/spec/nio/bytebuffer_spec.rb
CHANGED
@@ -1,5 +1,11 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
# Released under the MIT License.
|
4
|
+
# Copyright, 2016, by Upekshe Jayasekera.
|
5
|
+
# Copyright, 2016-2017, by Tony Arcieri.
|
6
|
+
# Copyright, 2019-2023, by Samuel Williams.
|
7
|
+
# Copyright, 2020, by Thomas Dziedzic.
|
8
|
+
|
3
9
|
require "spec_helper"
|
4
10
|
|
5
11
|
RSpec.describe NIO::ByteBuffer do
|
@@ -352,4 +358,3 @@ RSpec.describe NIO::ByteBuffer do
|
|
352
358
|
end
|
353
359
|
end
|
354
360
|
end
|
355
|
-
# rubocop:enable Metrics/BlockLength
|
data/spec/nio/monitor_spec.rb
CHANGED
@@ -1,5 +1,12 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
# Released under the MIT License.
|
4
|
+
# Copyright, 2011-2018, by Tony Arcieri.
|
5
|
+
# Copyright, 2012, by Logan Bowers.
|
6
|
+
# Copyright, 2015, by Tiago Cardoso.
|
7
|
+
# Copyright, 2015, by Upekshe Jayasekera.
|
8
|
+
# Copyright, 2018-2023, by Samuel Williams.
|
9
|
+
|
3
10
|
require "spec_helper"
|
4
11
|
require "socket"
|
5
12
|
|
@@ -1,5 +1,11 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
# Released under the MIT License.
|
4
|
+
# Copyright, 2012-2017, by Tony Arcieri.
|
5
|
+
# Copyright, 2012, by Logan Bowers.
|
6
|
+
# Copyright, 2017, by Gregory Longtin.
|
7
|
+
# Copyright, 2023, by Samuel Williams.
|
8
|
+
|
3
9
|
require "spec_helper"
|
4
10
|
|
5
11
|
RSpec.describe "IO.pipe" do
|
@@ -1,5 +1,12 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
# Released under the MIT License.
|
4
|
+
# Copyright, 2012-2017, by Tony Arcieri.
|
5
|
+
# Copyright, 2012, by Logan Bowers.
|
6
|
+
# Copyright, 2017-2020, by Gregory Longtin.
|
7
|
+
# Copyright, 2019, by Cédric Boutillier.
|
8
|
+
# Copyright, 2019-2023, by Samuel Williams.
|
9
|
+
|
3
10
|
require "spec_helper"
|
4
11
|
require "openssl"
|
5
12
|
|
@@ -1,5 +1,12 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
# Released under the MIT License.
|
4
|
+
# Copyright, 2012-2017, by Tony Arcieri.
|
5
|
+
# Copyright, 2012, by Bernd Ahlers.
|
6
|
+
# Copyright, 2012, by Logan Bowers.
|
7
|
+
# Copyright, 2013, by Tim Carey-Smith.
|
8
|
+
# Copyright, 2019-2023, by Samuel Williams.
|
9
|
+
|
3
10
|
require "spec_helper"
|
4
11
|
|
5
12
|
RSpec.describe TCPSocket do
|
@@ -1,5 +1,12 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
# Released under the MIT License.
|
4
|
+
# Copyright, 2012-2017, by Tony Arcieri.
|
5
|
+
# Copyright, 2017, by Gregory Longtin.
|
6
|
+
# Copyright, 2017, by Olle Jonsson.
|
7
|
+
# Copyright, 2019-2023, by Samuel Williams.
|
8
|
+
# Copyright, 2020, by Thomas Dziedzic.
|
9
|
+
|
3
10
|
require "spec_helper"
|
4
11
|
|
5
12
|
RSpec.describe UDPSocket, if: !defined?(JRUBY_VERSION) do
|
@@ -33,8 +40,8 @@ RSpec.describe UDPSocket, if: !defined?(JRUBY_VERSION) do
|
|
33
40
|
peer.send("X" * 1024, 0)
|
34
41
|
cntr += 1
|
35
42
|
t = select [], [peer], [], 0
|
36
|
-
rescue Errno::ECONNREFUSED =>
|
37
|
-
skip "Couldn't make writable UDPSocket subject: #{
|
43
|
+
rescue Errno::ECONNREFUSED => e
|
44
|
+
skip "Couldn't make writable UDPSocket subject: #{e.class}: #{e}"
|
38
45
|
end while t && t[1].include?(peer) && cntr < 5
|
39
46
|
|
40
47
|
peer
|
data/spec/nio/selector_spec.rb
CHANGED
@@ -1,5 +1,17 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
# Released under the MIT License.
|
4
|
+
# Copyright, 2011-2017, by Tony Arcieri.
|
5
|
+
# Copyright, 2012, by Logan Bowers.
|
6
|
+
# Copyright, 2013, by Ravil Bayramgalin.
|
7
|
+
# Copyright, 2013, by Tim Carey-Smith.
|
8
|
+
# Copyright, 2015, by Vladimir Kochnev.
|
9
|
+
# Copyright, 2016, by Tiago Cardoso.
|
10
|
+
# Copyright, 2019-2023, by Samuel Williams.
|
11
|
+
# Copyright, 2019, by Jesús Burgos Maciá.
|
12
|
+
# Copyright, 2020, by Thomas Dziedzic.
|
13
|
+
# Copyright, 2021, by Joao Fernandes.
|
14
|
+
|
3
15
|
require "spec_helper"
|
4
16
|
require "timeout"
|
5
17
|
|
@@ -24,6 +36,10 @@ RSpec.describe NIO::Selector do
|
|
24
36
|
example.reporter.message "Supported backends: #{described_class.backends}"
|
25
37
|
end
|
26
38
|
|
39
|
+
it "automatically selects a backend if none or nil is specified" do
|
40
|
+
expect(described_class.new.backend).to eq described_class.new(nil).backend
|
41
|
+
end
|
42
|
+
|
27
43
|
it "raises ArgumentError if given an invalid backend" do
|
28
44
|
expect { described_class.new(:derp) }.to raise_error ArgumentError
|
29
45
|
end
|
@@ -234,4 +250,3 @@ RSpec.describe NIO::Selector do
|
|
234
250
|
expect(subject).to be_closed
|
235
251
|
end
|
236
252
|
end
|
237
|
-
# rubocop:enable Metrics/BlockLength
|
data/spec/spec_helper.rb
CHANGED
@@ -1,7 +1,10 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
|
4
|
-
|
3
|
+
# Released under the MIT License.
|
4
|
+
# Copyright, 2011-2017, by Tony Arcieri.
|
5
|
+
# Copyright, 2017, by Gregory Longtin.
|
6
|
+
# Copyright, 2019-2023, by Samuel Williams.
|
7
|
+
# Copyright, 2021, by Joao Fernandes.
|
5
8
|
|
6
9
|
require "nio"
|
7
10
|
require "support/selectable_examples"
|
@@ -12,6 +15,8 @@ RSpec.configure do |config|
|
|
12
15
|
# Enable flags like --only-failures and --next-failure
|
13
16
|
config.example_status_persistence_file_path = ".rspec_status"
|
14
17
|
|
18
|
+
config.filter_run_when_matching :focus
|
19
|
+
|
15
20
|
config.expect_with :rspec do |c|
|
16
21
|
c.syntax = :expect
|
17
22
|
end
|
@@ -1,5 +1,13 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
# Released under the MIT License.
|
4
|
+
# Copyright, 2012-2017, by Tony Arcieri.
|
5
|
+
# Copyright, 2012, by Logan Bowers.
|
6
|
+
# Copyright, 2013, by Tim Carey-Smith.
|
7
|
+
# Copyright, 2017-2019, by Gregory Longtin.
|
8
|
+
# Copyright, 2017, by Tiago Cardoso.
|
9
|
+
# Copyright, 2019-2023, by Samuel Williams.
|
10
|
+
|
3
11
|
RSpec.shared_context NIO::Selector do
|
4
12
|
let(:selector) {@selector = NIO::Selector.new}
|
5
13
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: nio4r
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.7.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tony Arcieri
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-12-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -47,16 +47,14 @@ extensions:
|
|
47
47
|
- ext/nio4r/extconf.rb
|
48
48
|
extra_rdoc_files: []
|
49
49
|
files:
|
50
|
+
- ".github/workflows/workflow.yml"
|
50
51
|
- ".gitignore"
|
52
|
+
- ".mailmap"
|
51
53
|
- ".rspec"
|
52
54
|
- ".rubocop.yml"
|
53
|
-
- ".travis.yml"
|
54
|
-
- CHANGES.md
|
55
55
|
- Gemfile
|
56
|
-
- Guardfile
|
57
|
-
- README.md
|
58
56
|
- Rakefile
|
59
|
-
-
|
57
|
+
- changes.md
|
60
58
|
- examples/echo_server.rb
|
61
59
|
- ext/libev/Changes
|
62
60
|
- ext/libev/LICENSE
|
@@ -64,6 +62,7 @@ files:
|
|
64
62
|
- ext/libev/ev.c
|
65
63
|
- ext/libev/ev.h
|
66
64
|
- ext/libev/ev_epoll.c
|
65
|
+
- ext/libev/ev_iouring.c
|
67
66
|
- ext/libev/ev_kqueue.c
|
68
67
|
- ext/libev/ev_linuxaio.c
|
69
68
|
- ext/libev/ev_poll.c
|
@@ -72,6 +71,7 @@ files:
|
|
72
71
|
- ext/libev/ev_vars.h
|
73
72
|
- ext/libev/ev_win32.c
|
74
73
|
- ext/libev/ev_wrap.h
|
74
|
+
- ext/nio4r/.clang-format
|
75
75
|
- ext/nio4r/bytebuffer.c
|
76
76
|
- ext/nio4r/extconf.rb
|
77
77
|
- ext/nio4r/libev.h
|
@@ -88,11 +88,14 @@ files:
|
|
88
88
|
- lib/nio/monitor.rb
|
89
89
|
- lib/nio/selector.rb
|
90
90
|
- lib/nio/version.rb
|
91
|
+
- lib/nio4r.rb
|
92
|
+
- license.md
|
91
93
|
- logo.png
|
92
94
|
- nio4r.gemspec
|
93
95
|
- rakelib/extension.rake
|
94
96
|
- rakelib/rspec.rake
|
95
97
|
- rakelib/rubocop.rake
|
98
|
+
- readme.md
|
96
99
|
- spec/nio/acceptables_spec.rb
|
97
100
|
- spec/nio/bytebuffer_spec.rb
|
98
101
|
- spec/nio/monitor_spec.rb
|
@@ -105,14 +108,15 @@ files:
|
|
105
108
|
- spec/support/selectable_examples.rb
|
106
109
|
homepage: https://github.com/socketry/nio4r
|
107
110
|
licenses:
|
108
|
-
- MIT
|
111
|
+
- MIT AND (BSD-2-Clause OR GPL-2.0-or-later)
|
109
112
|
metadata:
|
110
113
|
bug_tracker_uri: https://github.com/socketry/nio4r/issues
|
111
|
-
changelog_uri: https://github.com/socketry/nio4r/blob/
|
112
|
-
documentation_uri: https://www.rubydoc.info/gems/nio4r/2.
|
113
|
-
source_code_uri: https://github.com/socketry/nio4r/tree/v2.
|
114
|
+
changelog_uri: https://github.com/socketry/nio4r/blob/main/changes.md
|
115
|
+
documentation_uri: https://www.rubydoc.info/gems/nio4r/2.6.1
|
116
|
+
source_code_uri: https://github.com/socketry/nio4r/tree/v2.6.1
|
114
117
|
wiki_uri: https://github.com/socketry/nio4r/wiki
|
115
|
-
|
118
|
+
funding_uri: https://github.com/sponsors/ioquatix/
|
119
|
+
post_install_message:
|
116
120
|
rdoc_options: []
|
117
121
|
require_paths:
|
118
122
|
- lib
|
@@ -120,15 +124,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
120
124
|
requirements:
|
121
125
|
- - ">="
|
122
126
|
- !ruby/object:Gem::Version
|
123
|
-
version: '2.
|
127
|
+
version: '2.4'
|
124
128
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
125
129
|
requirements:
|
126
130
|
- - ">="
|
127
131
|
- !ruby/object:Gem::Version
|
128
132
|
version: '0'
|
129
133
|
requirements: []
|
130
|
-
rubygems_version: 3.
|
131
|
-
signing_key:
|
134
|
+
rubygems_version: 3.4.22
|
135
|
+
signing_key:
|
132
136
|
specification_version: 4
|
133
137
|
summary: New IO for Ruby
|
134
138
|
test_files:
|
data/.travis.yml
DELETED
@@ -1,44 +0,0 @@
|
|
1
|
-
language: ruby
|
2
|
-
cache: bundler
|
3
|
-
dist: xenial
|
4
|
-
env: OS="xenial 16.04"
|
5
|
-
bundler_args: --without development
|
6
|
-
|
7
|
-
after_script:
|
8
|
-
- ruby -ropenssl -e "puts ENV['OS'], RUBY_DESCRIPTION, OpenSSL::OPENSSL_LIBRARY_VERSION"
|
9
|
-
|
10
|
-
matrix:
|
11
|
-
fast_finish: true
|
12
|
-
include:
|
13
|
-
- rvm: 2.3
|
14
|
-
- rvm: 2.4
|
15
|
-
- rvm: 2.5
|
16
|
-
- rvm: 2.6
|
17
|
-
env: NIO4R_PURE=true
|
18
|
-
- rvm: 2.6
|
19
|
-
- rvm: 2.3
|
20
|
-
dist: trusty
|
21
|
-
env: OS="trusty 14.04"
|
22
|
-
- rvm: 2.6.3
|
23
|
-
dist: bionic
|
24
|
-
env: OS="bionic 18.04"
|
25
|
-
- rvm: 2.6
|
26
|
-
os: osx
|
27
|
-
env: OS="osx"
|
28
|
-
- rvm: 2.4.6
|
29
|
-
os: osx
|
30
|
-
osx_image: xcode10.2
|
31
|
-
env: OS="osx xcode 10.2"
|
32
|
-
- rvm: truffleruby
|
33
|
-
- rvm: truffleruby
|
34
|
-
env: NIO4R_PURE=true
|
35
|
-
- rvm: jruby
|
36
|
-
env: JRUBY_OPTS="--debug -X+O --dev -J-Djruby.launch.inproc=true -J-Xmx1024M"
|
37
|
-
- rvm: jruby-head
|
38
|
-
env: JRUBY_OPTS="--debug -X+O --dev -J-Djruby.launch.inproc=true -J-Xmx1024M"
|
39
|
-
- rvm: ruby-head
|
40
|
-
allow_failures:
|
41
|
-
- rvm: ruby-head
|
42
|
-
- rvm: truffleruby
|
43
|
-
- rvm: jruby-head
|
44
|
-
- rvm: jruby
|
data/Guardfile
DELETED