nio4r 2.2.0-java → 2.3.0-java

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 221e18a17ac8c6566eb620526d6b0f70fba72a13
4
- data.tar.gz: cb3e78b46136229e792d13d92a0fd3aac8e5f81d
2
+ SHA256:
3
+ metadata.gz: 43270fa7bd80de10c62d7cf016d5aaa467826bed8fb9fdde9472781f23f2a5ee
4
+ data.tar.gz: 7c2707907b7480afaddb9d8eea003f8abbcf506bcb2f953332cfc05c9bb77c00
5
5
  SHA512:
6
- metadata.gz: ba80c79bd0d2a18342998c59bbfd4bf7152dec4003d5b1880e9cac36ca0ac7f7385bf228fd93bb70e58937ebfeb68230e768379839739855bb4f9e618fd127bc
7
- data.tar.gz: eecdbf21b6be0bfe01fd7a768ff70a80a4d1c43891fcb8b404d86ca3f2ccf8c024c5f972451e22a69c021972cabb02fcf31d1a87faef1a1dfe6e10fe11092362
6
+ metadata.gz: 037f13a47f6118849e41ae942421ae209d3a051ba449fb1f251dfbb7f3c79fb0457a25a829bbf21c397daba9092e9242ae04f3c6086e59940f95a91ebd862822
7
+ data.tar.gz: 437b0feab60bce714c2bb3a6322a0a84ffa9b3ce189feb52928302e67a8020cbf53102894a44744917e804784d018f3f8a6079dc42090cad4dfe476fdf425859
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
@@ -1,4 +1,4 @@
1
- Copyright (c) 2011-2017 Tony Arcieri
1
+ Copyright (c) 2011-2018 Tony Arcieri
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining
4
4
  a copy of this software and associated documentation files (the
data/README.md CHANGED
@@ -95,7 +95,7 @@ to maintain a large codebase.
95
95
 
96
96
  ## License
97
97
 
98
- Copyright (c) 2011-2017 Tony Arcieri. Distributed under the MIT License.
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.
@@ -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
- NIO_Monitor_update_interests(self, NIO_Monitor_symbol2interest(interests));
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 = interests;
299
+ if(monitor->interests != interests) {
300
+ monitor->interests = interests;
296
301
 
297
- ev_io_stop(monitor->selector->ev_loop, &monitor->ev_io);
298
- ev_io_set(&monitor->ev_io, monitor->ev_io.fd, monitor->interests);
299
- ev_io_start(monitor->selector->ev_loop, &monitor->ev_io);
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
- key.interestOps(Nio4r.symbolToInterestOps(ruby, channel, interests));
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;
@@ -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 %i[r w rw].include?(interests)
34
+ raise ArgumentError, "bad interests: #{interests}" unless [:r, :w, :rw, nil].include?(interests)
35
35
 
36
36
  @interests = interests
37
37
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module NIO
4
- VERSION = "2.2.0".freeze
4
+ VERSION = "2.3.0".freeze
5
5
  end
@@ -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.2.0
4
+ version: 2.3.0
5
5
  platform: java
6
6
  authors:
7
7
  - Tony Arcieri
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-12-27 00:00:00.000000000 Z
11
+ date: 2018-03-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  requirement: !ruby/object:Gem::Requirement
@@ -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.6.14
128
+ rubygems_version: 2.7.4
129
129
  signing_key:
130
130
  specification_version: 4
131
131
  summary: New IO for Ruby