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 +4 -4
- data/.travis.yml +1 -1
- data/CHANGES.md +6 -0
- data/ext/nio4r/monitor.c +19 -9
- data/ext/nio4r/selector.c +2 -0
- data/lib/nio/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c88a32f43cf5641855c0e4a43a41b7d39feb95375adc7fd000fd5dde6af7f196
|
4
|
+
data.tar.gz: 002e8e31de2d8684c5a04aa224de9a21ab9f3faeda6aa32e89d3642da2160e89
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6479c8cb7074dd20b4b0db25b694dc23c3d5350f6354ee43423035d1f1f8cca69c1f4c3b0ae48e120793c3c3bfac9f92e59d199084653308de183b68741c92a7
|
7
|
+
data.tar.gz: 3b80ae22d65d9699d096475ecd53cfa92f23514c45a7cf0c91391abfc2afbaa3869be67e8b92f2c7138d56b3547b4f688948b39d82dca3381b56fce0b986684d
|
data/.travis.yml
CHANGED
data/CHANGES.md
CHANGED
data/ext/nio4r/monitor.c
CHANGED
@@ -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
|
-
|
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
|
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
|
180
|
-
NIO_Monitor_update_interests(self,
|
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
|
190
|
-
NIO_Monitor_update_interests(self,
|
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
|
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
|
-
|
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
|
-
|
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
|
}
|
data/ext/nio4r/selector.c
CHANGED
@@ -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;
|
data/lib/nio/version.rb
CHANGED
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.
|
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-
|
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
|