nio4r 2.0.0 → 2.1.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/.travis.yml +11 -4
- data/CHANGES.md +19 -0
- data/LICENSE.txt +1 -1
- data/README.md +18 -7
- data/ext/libev/Changes +5 -0
- data/ext/libev/ev.h +1 -6
- data/ext/nio4r/extconf.rb +2 -0
- data/ext/nio4r/nio4r.h +1 -1
- data/ext/nio4r/nio4r_ext.c +2 -2
- data/ext/nio4r/selector.c +20 -12
- data/lib/nio/version.rb +1 -1
- data/spec/spec_helper.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 72ea8743f4a16dc03e219310a3cd15321cfda343
|
4
|
+
data.tar.gz: 7145084d017ff49d5356a76db8a666702fd080f8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1fd8b916c17bc23d47c20413c4d829d7ee0cf3e6f5b0e00ca36fd40475750668a2cf46545f17e0096893ce67dbdf99b675621c73a99cf3ffc3b22380586846fd
|
7
|
+
data.tar.gz: af5f4bc6ee1c657e9092b1eafcb7c4ee8d39bccee51e1bf24394f8ce989ef7e713a12fb90a298810317351128119f9e2c0ab87386b0c60809c77202a0d1e2e0d
|
data/.travis.yml
CHANGED
@@ -2,6 +2,10 @@ language: ruby
|
|
2
2
|
sudo: false
|
3
3
|
cache: bundler
|
4
4
|
|
5
|
+
before_install:
|
6
|
+
- gem update --system 2.6.10
|
7
|
+
- gem --version
|
8
|
+
|
5
9
|
bundler_args: --without development
|
6
10
|
|
7
11
|
branches:
|
@@ -9,10 +13,11 @@ branches:
|
|
9
13
|
- master
|
10
14
|
|
11
15
|
rvm:
|
12
|
-
- jruby-9.1.
|
13
|
-
- 2.2.
|
14
|
-
- 2.3.
|
15
|
-
- 2.4.
|
16
|
+
- jruby-9.1.10.0 # latest stable
|
17
|
+
- 2.2.7
|
18
|
+
- 2.3.4
|
19
|
+
- 2.4.1
|
20
|
+
- ruby-head
|
16
21
|
|
17
22
|
env:
|
18
23
|
global:
|
@@ -22,6 +27,8 @@ env:
|
|
22
27
|
- NIO4R_PURE=true
|
23
28
|
|
24
29
|
matrix:
|
30
|
+
allow_failures:
|
31
|
+
- rvm: ruby-head
|
25
32
|
fast_finish: true
|
26
33
|
|
27
34
|
notifications:
|
data/CHANGES.md
CHANGED
@@ -1,3 +1,21 @@
|
|
1
|
+
## 2.1.0 (2017-05-28)
|
2
|
+
|
3
|
+
* [#130](https://github.com/socketry/nio4r/pull/130)
|
4
|
+
Add -fno-strict-aliasing flag when compiling C ext.
|
5
|
+
([@junaruga])
|
6
|
+
|
7
|
+
* [#146](https://github.com/socketry/nio4r/pull/146)
|
8
|
+
Use non-blocking select when a timeout of 0 is given.
|
9
|
+
([@tarcieri])
|
10
|
+
|
11
|
+
* [#147](https://github.com/socketry/nio4r/pull/147)
|
12
|
+
Update to libev 4.24.
|
13
|
+
([@tarcieri])
|
14
|
+
|
15
|
+
* [#148](https://github.com/socketry/nio4r/pull/148)
|
16
|
+
Switch to the libev 4 API internally.
|
17
|
+
([@tarcieri])
|
18
|
+
|
1
19
|
## 2.0.0 (2016-12-28)
|
2
20
|
|
3
21
|
* [#53](https://github.com/socketry/nio4r/pull/53)
|
@@ -144,3 +162,4 @@
|
|
144
162
|
[@tarcieri]: https://github.com/tarcieri
|
145
163
|
[@johnnyt]: https://github.com/johnnyt
|
146
164
|
[@UpeksheJay]: https://github.com/UpeksheJay
|
165
|
+
[@junaruga]: https://github.com/junaruga
|
data/LICENSE.txt
CHANGED
data/README.md
CHANGED
@@ -6,8 +6,8 @@
|
|
6
6
|
[](https://coveralls.io/r/socketry/nio4r)
|
7
7
|
[](https://github.com/socketry/nio4r/blob/master/LICENSE.txt)
|
8
8
|
|
9
|
-
_NOTE: This is the 2.x **
|
10
|
-
|
9
|
+
_NOTE: This is the 2.x **stable** branch of nio4r. For the 1.x **legacy** branch,
|
10
|
+
please see:_
|
11
11
|
|
12
12
|
https://github.com/socketry/nio4r/tree/1-x-stable
|
13
13
|
|
@@ -20,15 +20,15 @@ I/O selectors are the heart of "reactor"-based event loops, and monitor
|
|
20
20
|
multiple I/O objects for various types of readiness, e.g. ready for reading or
|
21
21
|
writing.
|
22
22
|
|
23
|
-
[Rails 5]: https://rubygems.org/gems/actioncable
|
24
|
-
|
25
23
|
## Projects using nio4r
|
26
24
|
|
27
25
|
* [ActionCable]: Rails 5 WebSocket protocol, uses nio4r for a WebSocket server
|
28
26
|
* [Celluloid::IO]: Actor-based concurrency framework, uses nio4r for async I/O
|
27
|
+
* [Socketry Async]: Asynchronous I/O framework for Ruby
|
29
28
|
|
30
29
|
[ActionCable]: https://rubygems.org/gems/actioncable
|
31
|
-
[Celluloid::IO]: https://github.com/
|
30
|
+
[Celluloid::IO]: https://github.com/celluloid/celluloid-io
|
31
|
+
[Socketry Async]: https://github.com/socketry/async
|
32
32
|
|
33
33
|
## Goals
|
34
34
|
|
@@ -50,6 +50,17 @@ writing.
|
|
50
50
|
* **Java NIO**: JRuby extension which wraps the Java NIO subsystem
|
51
51
|
* **Pure Ruby**: `Kernel.select`-based backend that should work on any Ruby interpreter
|
52
52
|
|
53
|
+
## Discussion
|
54
|
+
|
55
|
+
For discussion and general help with nio4r, email
|
56
|
+
[socketry+subscribe@googlegroups.com][subscribe]
|
57
|
+
or join on the web via the [Google Group].
|
58
|
+
|
59
|
+
We're also on IRC at ##socketry on irc.freenode.net.
|
60
|
+
|
61
|
+
[subscribe]: mailto:socketry+subscribe@googlegroups.com
|
62
|
+
[google group]: https://groups.google.com/group/socketry
|
63
|
+
|
53
64
|
## Documentation
|
54
65
|
|
55
66
|
[Please see the nio4r wiki](https://github.com/socketry/nio4r/wiki)
|
@@ -82,10 +93,10 @@ to maintain a large codebase.
|
|
82
93
|
|
83
94
|
## License
|
84
95
|
|
85
|
-
Copyright (c) 2011-
|
96
|
+
Copyright (c) 2011-2017 Tony Arcieri. Distributed under the MIT License.
|
86
97
|
See [LICENSE.txt] for further details.
|
87
98
|
|
88
|
-
Includes libev 4.
|
99
|
+
Includes libev 4.24. Copyright (c) 2007-2016 Marc Alexander Lehmann.
|
89
100
|
Distributed under the BSD license. See [ext/libev/LICENSE] for details.
|
90
101
|
|
91
102
|
[LICENSE.txt]: https://github.com/socketry/nio4r/blob/master/LICENSE.txt
|
data/ext/libev/Changes
CHANGED
@@ -1,5 +1,10 @@
|
|
1
1
|
Revision history for libev, a high-performance and full-featured event loop.
|
2
2
|
|
3
|
+
4.24 Wed Dec 28 05:19:55 CET 2016
|
4
|
+
- bump version to 4.24, as the release tarball inexplicably
|
5
|
+
didn't have the right version in ev.h, even though the cvs-tagged
|
6
|
+
version did have the right one (reported by Ales Teska).
|
7
|
+
|
3
8
|
4.23 Wed Nov 16 18:23:41 CET 2016
|
4
9
|
- move some declarations at the beginning to help certain retarded
|
5
10
|
microsoft compilers, even though their documentation claims
|
data/ext/libev/ev.h
CHANGED
@@ -56,11 +56,6 @@ EV_CPP(extern "C" {)
|
|
56
56
|
|
57
57
|
/*****************************************************************************/
|
58
58
|
|
59
|
-
/* pre-4.0 compatibility */
|
60
|
-
#ifndef EV_COMPAT3
|
61
|
-
# define EV_COMPAT3 1
|
62
|
-
#endif
|
63
|
-
|
64
59
|
#ifndef EV_FEATURES
|
65
60
|
# if defined __OPTIMIZE_SIZE__
|
66
61
|
# define EV_FEATURES 0x7c
|
@@ -211,7 +206,7 @@ struct ev_loop;
|
|
211
206
|
/*****************************************************************************/
|
212
207
|
|
213
208
|
#define EV_VERSION_MAJOR 4
|
214
|
-
#define EV_VERSION_MINOR
|
209
|
+
#define EV_VERSION_MINOR 24
|
215
210
|
|
216
211
|
/* eventmask, revents, events... */
|
217
212
|
enum {
|
data/ext/nio4r/extconf.rb
CHANGED
data/ext/nio4r/nio4r.h
CHANGED
data/ext/nio4r/nio4r_ext.c
CHANGED
data/ext/nio4r/selector.c
CHANGED
@@ -49,8 +49,8 @@ static VALUE NIO_Selector_close_synchronized(VALUE *args);
|
|
49
49
|
static VALUE NIO_Selector_closed_synchronized(VALUE *args);
|
50
50
|
|
51
51
|
static int NIO_Selector_run(struct NIO_Selector *selector, VALUE timeout);
|
52
|
-
static void NIO_Selector_timeout_callback(
|
53
|
-
static void NIO_Selector_wakeup_callback(
|
52
|
+
static void NIO_Selector_timeout_callback(ev_loop *ev_loop, struct ev_timer *timer, int revents);
|
53
|
+
static void NIO_Selector_wakeup_callback(ev_loop *ev_loop, struct ev_io *io, int revents);
|
54
54
|
|
55
55
|
/* Default number of slots in the buffer for selected monitors */
|
56
56
|
#define INITIAL_READY_BUFFER 32
|
@@ -359,22 +359,30 @@ static VALUE NIO_Selector_select_synchronized(VALUE *args)
|
|
359
359
|
|
360
360
|
static int NIO_Selector_run(struct NIO_Selector *selector, VALUE timeout)
|
361
361
|
{
|
362
|
+
int ev_run_flags = EVRUN_ONCE;
|
362
363
|
int result;
|
364
|
+
double timeout_val;
|
363
365
|
|
364
366
|
selector->selecting = 1;
|
365
367
|
selector->wakeup_fired = 0;
|
366
368
|
|
367
|
-
|
368
|
-
|
369
|
-
/* It seems libev is not a fan of timers being zero, so fudge a little */
|
370
|
-
selector->timer.repeat = NUM2DBL(timeout) + 0.0001;
|
371
|
-
ev_timer_again(selector->ev_loop, &selector->timer);
|
372
|
-
} else {
|
369
|
+
if(timeout == Qnil) {
|
370
|
+
/* Don't fire a wakeup timeout if we weren't passed one */
|
373
371
|
ev_timer_stop(selector->ev_loop, &selector->timer);
|
372
|
+
} else {
|
373
|
+
timeout_val = NUM2DBL(timeout);
|
374
|
+
if(timeout_val == 0) {
|
375
|
+
/* If we've been given an explicit timeout of 0, perform a non-blocking
|
376
|
+
select operation */
|
377
|
+
ev_run_flags = EVRUN_NOWAIT;
|
378
|
+
} else {
|
379
|
+
selector->timer.repeat = timeout_val;
|
380
|
+
ev_timer_again(selector->ev_loop, &selector->timer);
|
381
|
+
}
|
374
382
|
}
|
375
383
|
|
376
384
|
/* libev is patched to release the GIL when it makes its system call */
|
377
|
-
|
385
|
+
ev_run(selector->ev_loop, ev_run_flags);
|
378
386
|
|
379
387
|
result = selector->ready_count;
|
380
388
|
selector->selecting = selector->ready_count = 0;
|
@@ -447,12 +455,12 @@ static VALUE NIO_Selector_is_empty(VALUE self)
|
|
447
455
|
|
448
456
|
|
449
457
|
/* Called whenever a timeout fires on the event loop */
|
450
|
-
static void NIO_Selector_timeout_callback(
|
458
|
+
static void NIO_Selector_timeout_callback(ev_loop *ev_loop, struct ev_timer *timer, int revents)
|
451
459
|
{
|
452
460
|
}
|
453
461
|
|
454
462
|
/* Called whenever a wakeup request is sent to a selector */
|
455
|
-
static void NIO_Selector_wakeup_callback(
|
463
|
+
static void NIO_Selector_wakeup_callback(ev_loop *ev_loop, struct ev_io *io, int revents)
|
456
464
|
{
|
457
465
|
char buffer[128];
|
458
466
|
struct NIO_Selector *selector = (struct NIO_Selector *)io->data;
|
@@ -463,7 +471,7 @@ static void NIO_Selector_wakeup_callback(struct ev_loop *ev_loop, struct ev_io *
|
|
463
471
|
}
|
464
472
|
|
465
473
|
/* libev callback fired whenever a monitor gets an event */
|
466
|
-
void NIO_Selector_monitor_callback(
|
474
|
+
void NIO_Selector_monitor_callback(ev_loop *ev_loop, struct ev_io *io, int revents)
|
467
475
|
{
|
468
476
|
struct NIO_Monitor *monitor_data = (struct NIO_Monitor *)io->data;
|
469
477
|
struct NIO_Selector *selector = monitor_data->selector;
|
data/lib/nio/version.rb
CHANGED
data/spec/spec_helper.rb
CHANGED
@@ -20,7 +20,7 @@ def next_available_tcp_port
|
|
20
20
|
$current_tcp_port += 1
|
21
21
|
|
22
22
|
begin
|
23
|
-
sock = Timeout.timeout(
|
23
|
+
sock = Timeout.timeout(1) { TCPSocket.new("localhost", $current_tcp_port) }
|
24
24
|
rescue Errno::ECONNREFUSED
|
25
25
|
break $current_tcp_port
|
26
26
|
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.
|
4
|
+
version: 2.1.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: 2017-05-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -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.
|
128
|
+
rubygems_version: 2.6.11
|
129
129
|
signing_key:
|
130
130
|
specification_version: 4
|
131
131
|
summary: New IO for Ruby
|