nio4r 2.2.0 → 2.3.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/CHANGES.md +7 -0
- data/LICENSE.txt +1 -1
- data/README.md +1 -1
- data/ext/nio4r/monitor.c +11 -5
- data/ext/nio4r/org/nio4r/Monitor.java +6 -1
- data/lib/nio/monitor.rb +2 -2
- data/lib/nio/version.rb +1 -1
- data/spec/nio/monitor_spec.rb +6 -0
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cfaa168a1d757e1242d427f89189e39f424039c30fe6a384194166ae7a6e6694
|
4
|
+
data.tar.gz: fe2f130edf1d7963672302b21210a18d915583d096c1721b65e8ec9dc702b5ce
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0a195646b2139336075368785eeb77e2de30f700c0845cd14696572685dcfeded9e023761414ed01485e0d617ce96790c6e97cc810bfb95ed600e44cf467ac55
|
7
|
+
data.tar.gz: fa758ef58d38dbe41c44936998d00830e9058b1daef51fe30f551b15ed2148121d5c536dfee8c2ac9c8f064000b8df170b30cb5f87fbc7c4cb6348bd92d3ec15
|
data/CHANGES.md
CHANGED
@@ -1,3 +1,9 @@
|
|
1
|
+
## 2.3.0 (2018-03-15)
|
2
|
+
|
3
|
+
* [#183](https://github.com/socketry/nio4r/pull/183)
|
4
|
+
Allow `Monitor#interests` to be nil
|
5
|
+
([@ioquatix])
|
6
|
+
|
1
7
|
## 2.2.0 (2017-12-27)
|
2
8
|
|
3
9
|
* [#151](https://github.com/socketry/nio4r/pull/151)
|
@@ -206,3 +212,4 @@
|
|
206
212
|
[@larskanis]: https://github.com/larskanis
|
207
213
|
[@HoneyryderChuck]: https://github.com/HoneyryderChuck
|
208
214
|
[@tompng]: https://github.com/tompng
|
215
|
+
[@ioquatix]: https://github.com/ioquatix
|
data/LICENSE.txt
CHANGED
data/README.md
CHANGED
@@ -95,7 +95,7 @@ to maintain a large codebase.
|
|
95
95
|
|
96
96
|
## License
|
97
97
|
|
98
|
-
Copyright (c) 2011-
|
98
|
+
Copyright (c) 2011-2018 Tony Arcieri. Distributed under the MIT License.
|
99
99
|
See [LICENSE.txt] for further details.
|
100
100
|
|
101
101
|
Includes libev 4.24. Copyright (c) 2007-2016 Marc Alexander Lehmann.
|
data/ext/nio4r/monitor.c
CHANGED
@@ -163,7 +163,11 @@ static VALUE NIO_Monitor_interests(VALUE self)
|
|
163
163
|
|
164
164
|
static VALUE NIO_Monitor_set_interests(VALUE self, VALUE interests)
|
165
165
|
{
|
166
|
-
|
166
|
+
if(NIL_P(interests)) {
|
167
|
+
NIO_Monitor_update_interests(self, 0);
|
168
|
+
} else {
|
169
|
+
NIO_Monitor_update_interests(self, NIO_Monitor_symbol2interest(interests));
|
170
|
+
}
|
167
171
|
|
168
172
|
return rb_ivar_get(self, rb_intern("interests"));
|
169
173
|
}
|
@@ -292,9 +296,11 @@ static void NIO_Monitor_update_interests(VALUE self, int interests)
|
|
292
296
|
rb_ivar_set(self, rb_intern("interests"), Qnil);
|
293
297
|
}
|
294
298
|
|
295
|
-
monitor->interests
|
299
|
+
if(monitor->interests != interests) {
|
300
|
+
monitor->interests = interests;
|
296
301
|
|
297
|
-
|
298
|
-
|
299
|
-
|
302
|
+
ev_io_stop(monitor->selector->ev_loop, &monitor->ev_io);
|
303
|
+
ev_io_set(&monitor->ev_io, monitor->ev_io.fd, monitor->interests);
|
304
|
+
ev_io_start(monitor->selector->ev_loop, &monitor->ev_io);
|
305
|
+
}
|
300
306
|
}
|
@@ -62,7 +62,12 @@ public class Monitor extends RubyObject {
|
|
62
62
|
Ruby ruby = context.getRuntime();
|
63
63
|
SelectableChannel channel = (SelectableChannel)io.getChannel();
|
64
64
|
|
65
|
-
|
65
|
+
if(interests != context.nil) {
|
66
|
+
key.interestOps(Nio4r.symbolToInterestOps(ruby, channel, interests));
|
67
|
+
} else {
|
68
|
+
key.interestOps(0);
|
69
|
+
}
|
70
|
+
|
66
71
|
this.interests = interests;
|
67
72
|
|
68
73
|
return this.interests;
|
data/lib/nio/monitor.rb
CHANGED
@@ -26,12 +26,12 @@ module NIO
|
|
26
26
|
|
27
27
|
# Replace the existing interest set with a new one
|
28
28
|
#
|
29
|
-
# @param interests [:r, :w, :rw] I/O readiness we're interested in (read/write/readwrite)
|
29
|
+
# @param interests [:r, :w, :rw, nil] I/O readiness we're interested in (read/write/readwrite)
|
30
30
|
#
|
31
31
|
# @return [Symbol] new interests
|
32
32
|
def interests=(interests)
|
33
33
|
raise EOFError, "monitor is closed" if closed?
|
34
|
-
raise ArgumentError, "bad interests: #{interests}" unless
|
34
|
+
raise ArgumentError, "bad interests: #{interests}" unless [:r, :w, :rw, nil].include?(interests)
|
35
35
|
|
36
36
|
@interests = interests
|
37
37
|
end
|
data/lib/nio/version.rb
CHANGED
data/spec/nio/monitor_spec.rb
CHANGED
@@ -29,6 +29,12 @@ RSpec.describe NIO::Monitor do
|
|
29
29
|
end
|
30
30
|
|
31
31
|
describe "#interests=" do
|
32
|
+
it "can set interests to nil" do
|
33
|
+
expect(monitor.interests).not_to eq(nil)
|
34
|
+
monitor.interests = nil
|
35
|
+
expect(monitor.interests).to eq(nil)
|
36
|
+
end
|
37
|
+
|
32
38
|
it "changes the interest set" do
|
33
39
|
expect(monitor.interests).not_to eq(:w)
|
34
40
|
monitor.interests = :w
|
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.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tony Arcieri
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2018-03-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -125,7 +125,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
125
125
|
version: '0'
|
126
126
|
requirements: []
|
127
127
|
rubyforge_project:
|
128
|
-
rubygems_version: 2.7.
|
128
|
+
rubygems_version: 2.7.4
|
129
129
|
signing_key:
|
130
130
|
specification_version: 4
|
131
131
|
summary: New IO for Ruby
|