nio4r 2.0.0 → 2.1.0

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
2
  SHA1:
3
- metadata.gz: 9f553c279692e1cf308af13c716610b424caca04
4
- data.tar.gz: 7cd52022633fd0a5d2ba26f003e976505a783237
3
+ metadata.gz: 72ea8743f4a16dc03e219310a3cd15321cfda343
4
+ data.tar.gz: 7145084d017ff49d5356a76db8a666702fd080f8
5
5
  SHA512:
6
- metadata.gz: 6bdc6f608f34b8be39efa968e523f9bac24da9dc976467afb7ff2d271ca234b6c46d614f37f2c5b82bcbab56c11b3835d0c2c5c26028b794b1dd26ffdee86b83
7
- data.tar.gz: 32a6b982cbd25605a031d39b7fdb9208b767be7d11f842405fd081f384addb372e1e1fec846176e78f5a77c81e8a21bdf5709eb76753fd85b43583b819e75d5d
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.6.0 # latest stable
13
- - 2.2.2
14
- - 2.3.3
15
- - 2.4.0
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
@@ -1,4 +1,4 @@
1
- Copyright (c) 2011-16 Tony Arcieri
1
+ Copyright (c) 2011-2017 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
@@ -6,8 +6,8 @@
6
6
  [![Coverage Status](https://coveralls.io/repos/socketry/nio4r/badge.svg?branch=master)](https://coveralls.io/r/socketry/nio4r)
7
7
  [![MIT licensed](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/socketry/nio4r/blob/master/LICENSE.txt)
8
8
 
9
- _NOTE: This is the 2.x **development** branch of nio4r. For the 1.x **stable**
10
- branch (used by [Rails 5]), please see:_
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/socketry/socketry-io
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-2016 Tony Arcieri. Distributed under the MIT License.
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.23. Copyright (c) 2007-2016 Marc Alexander Lehmann.
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 22
209
+ #define EV_VERSION_MINOR 24
215
210
 
216
211
  /* eventmask, revents, events... */
217
212
  enum {
data/ext/nio4r/extconf.rb CHANGED
@@ -18,6 +18,8 @@ $defs << "-DEV_USE_PORT" if have_header("port.h")
18
18
 
19
19
  $defs << "-DHAVE_SYS_RESOURCE_H" if have_header("sys/resource.h")
20
20
 
21
+ CONFIG["optflags"] << " -fno-strict-aliasing"
22
+
21
23
  dir_config "nio4r_ext"
22
24
  create_makefile "nio4r_ext"
23
25
 
data/ext/nio4r/nio4r.h CHANGED
@@ -12,7 +12,7 @@
12
12
 
13
13
  struct NIO_Selector
14
14
  {
15
- struct ev_loop *ev_loop;
15
+ ev_loop *ev_loop;
16
16
  struct ev_timer timer; /* for timeouts */
17
17
  struct ev_io wakeup;
18
18
 
@@ -1,6 +1,6 @@
1
1
  /*
2
- * Copyright (c) 2011 Tony Arcieri. Distributed under the MIT License. See
3
- * LICENSE.txt for further details.
2
+ * Copyright (c) 2011-2017 Tony Arcieri. Distributed under the MIT License.
3
+ * See LICENSE.txt for further details.
4
4
  */
5
5
 
6
6
  #include "nio4r.h"
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(struct ev_loop *ev_loop, struct ev_timer *timer, int revents);
53
- static void NIO_Selector_wakeup_callback(struct ev_loop *ev_loop, struct ev_io *io, int revents);
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
- /* Implement the optional timeout (if any) as a ev_timer */
368
- if(timeout != Qnil) {
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
- ev_loop(selector->ev_loop, EVLOOP_ONESHOT);
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(struct ev_loop *ev_loop, struct ev_timer *timer, int revents)
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(struct ev_loop *ev_loop, struct ev_io *io, int revents)
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(struct ev_loop *ev_loop, struct ev_io *io, int revents)
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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module NIO
4
- VERSION = "2.0.0"
4
+ VERSION = "2.1.0"
5
5
  end
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(0.1) { TCPSocket.new("localhost", $current_tcp_port) }
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.0.0
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: 2016-12-29 00:00:00.000000000 Z
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.8
128
+ rubygems_version: 2.6.11
129
129
  signing_key:
130
130
  specification_version: 4
131
131
  summary: New IO for Ruby