nio4r 2.3.0 → 2.3.1
Sign up to get free protection for your applications and to get access to all the features.
- 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: f8796c2f2ce109bc99fe6fab1010bebdb8715cfbfbc31ca0aabbce1d9e56acd4
|
4
|
+
data.tar.gz: 15ff6b62bfa43c5d730c22961e7ab2c4232f4b060cb1632ca5ff649b108dd99e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 17d0b1f7c63515a6ce68b1451a682dd0e4b4a4b3fc5fb8709b368bc90733c9fa5f54da3f8178500b16f6a28c08bfb85fca2fe4a4c61b12fd3a93713f73ae964a
|
7
|
+
data.tar.gz: 904c80947418c7ef90405f9e392993de05666801882ba7ddaab190d86b8f76606c769f763a1da9a7b23f649499bb2ae5578f0717b40927d33fe39d7987b68714
|
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: ruby
|
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
|
name: bundler
|