nio4r 2.3.0-java → 2.3.1-java

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 43270fa7bd80de10c62d7cf016d5aaa467826bed8fb9fdde9472781f23f2a5ee
4
- data.tar.gz: 7c2707907b7480afaddb9d8eea003f8abbcf506bcb2f953332cfc05c9bb77c00
3
+ metadata.gz: c88a32f43cf5641855c0e4a43a41b7d39feb95375adc7fd000fd5dde6af7f196
4
+ data.tar.gz: 002e8e31de2d8684c5a04aa224de9a21ab9f3faeda6aa32e89d3642da2160e89
5
5
  SHA512:
6
- metadata.gz: 037f13a47f6118849e41ae942421ae209d3a051ba449fb1f251dfbb7f3c79fb0457a25a829bbf21c397daba9092e9242ae04f3c6086e59940f95a91ebd862822
7
- data.tar.gz: 437b0feab60bce714c2bb3a6322a0a84ffa9b3ce189feb52928302e67a8020cbf53102894a44744917e804784d018f3f8a6079dc42090cad4dfe476fdf425859
6
+ metadata.gz: 6479c8cb7074dd20b4b0db25b694dc23c3d5350f6354ee43423035d1f1f8cca69c1f4c3b0ae48e120793c3c3bfac9f92e59d199084653308de183b68741c92a7
7
+ data.tar.gz: 3b80ae22d65d9699d096475ecd53cfa92f23514c45a7cf0c91391abfc2afbaa3869be67e8b92f2c7138d56b3547b4f688948b39d82dca3381b56fce0b986684d
@@ -13,7 +13,7 @@ branches:
13
13
  - master
14
14
 
15
15
  rvm:
16
- - jruby-9.1.15.0 # latest stable
16
+ - jruby-9.1.17.0 # latest stable
17
17
  - 2.2.7
18
18
  - 2.3.4
19
19
  - 2.4.1
data/CHANGES.md CHANGED
@@ -1,3 +1,9 @@
1
+ ## 2.3.1 (2018-05-03)
2
+
3
+ * [#188](https://github.com/socketry/nio4r/pull/188)
4
+ Fix remove interests
5
+ ([@ioquatix])
6
+
1
7
  ## 2.3.0 (2018-03-15)
2
8
 
3
9
  * [#183](https://github.com/socketry/nio4r/pull/183)
@@ -111,7 +111,9 @@ static VALUE NIO_Monitor_initialize(VALUE self, VALUE io, VALUE interests, VALUE
111
111
  object where it originally came from */
112
112
  monitor->selector = selector;
113
113
 
114
- ev_io_start(selector->ev_loop, &monitor->ev_io);
114
+ if (monitor->interests) {
115
+ ev_io_start(selector->ev_loop, &monitor->ev_io);
116
+ }
115
117
 
116
118
  return Qnil;
117
119
  }
@@ -127,7 +129,7 @@ static VALUE NIO_Monitor_close(int argc, VALUE *argv, VALUE self)
127
129
 
128
130
  if(selector != Qnil) {
129
131
  /* if ev_loop is 0, it means that the loop has been stopped already (see NIO_Selector_shutdown) */
130
- if(monitor->selector->ev_loop != 0) {
132
+ if(monitor->interests && monitor->selector->ev_loop) {
131
133
  ev_io_stop(monitor->selector->ev_loop, &monitor->ev_io);
132
134
  }
133
135
 
@@ -176,8 +178,8 @@ static VALUE NIO_Monitor_add_interest(VALUE self, VALUE interest) {
176
178
  struct NIO_Monitor *monitor;
177
179
  Data_Get_Struct(self, struct NIO_Monitor, monitor);
178
180
 
179
- monitor->interests |= NIO_Monitor_symbol2interest(interest);
180
- NIO_Monitor_update_interests(self, monitor->interests);
181
+ interest = monitor->interests | NIO_Monitor_symbol2interest(interest);
182
+ NIO_Monitor_update_interests(self, interest);
181
183
 
182
184
  return rb_ivar_get(self, rb_intern("interests"));
183
185
  }
@@ -186,8 +188,8 @@ static VALUE NIO_Monitor_remove_interest(VALUE self, VALUE interest) {
186
188
  struct NIO_Monitor *monitor;
187
189
  Data_Get_Struct(self, struct NIO_Monitor, monitor);
188
190
 
189
- monitor->interests &= ~NIO_Monitor_symbol2interest(interest);
190
- NIO_Monitor_update_interests(self, monitor->interests);
191
+ interest = monitor->interests & ~NIO_Monitor_symbol2interest(interest);
192
+ NIO_Monitor_update_interests(self, interest);
191
193
 
192
194
  return rb_ivar_get(self, rb_intern("interests"));
193
195
  }
@@ -297,10 +299,18 @@ static void NIO_Monitor_update_interests(VALUE self, int interests)
297
299
  }
298
300
 
299
301
  if(monitor->interests != interests) {
300
- monitor->interests = interests;
302
+ // If the monitor currently has interests, we should stop it.
303
+ if(monitor->interests) {
304
+ ev_io_stop(monitor->selector->ev_loop, &monitor->ev_io);
305
+ }
301
306
 
302
- ev_io_stop(monitor->selector->ev_loop, &monitor->ev_io);
307
+ // Assign the interests we are now monitoring for:
308
+ monitor->interests = interests;
303
309
  ev_io_set(&monitor->ev_io, monitor->ev_io.fd, monitor->interests);
304
- ev_io_start(monitor->selector->ev_loop, &monitor->ev_io);
310
+
311
+ // If we are interested in events, schedule the monitor back into the event loop:
312
+ if(monitor->interests) {
313
+ ev_io_start(monitor->selector->ev_loop, &monitor->ev_io);
314
+ }
305
315
  }
306
316
  }
@@ -552,6 +552,8 @@ void NIO_Selector_monitor_callback(ev_loop *ev_loop, struct ev_io *io, int reven
552
552
  struct NIO_Selector *selector = monitor_data->selector;
553
553
  VALUE monitor = monitor_data->self;
554
554
 
555
+ assert(monitor_data->interests != 0);
556
+
555
557
  assert(selector != 0);
556
558
  selector->ready_count++;
557
559
  monitor_data->revents = revents;
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module NIO
4
- VERSION = "2.3.0".freeze
4
+ VERSION = "2.3.1".freeze
5
5
  end
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.3.0
4
+ version: 2.3.1
5
5
  platform: java
6
6
  authors:
7
7
  - Tony Arcieri
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-03-16 00:00:00.000000000 Z
11
+ date: 2018-05-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  requirement: !ruby/object:Gem::Requirement