nio4r 2.0.0.pre-java → 2.1.0-java

Sign up to get free protection for your applications and to get access to all the features.
Files changed (50) hide show
  1. checksums.yaml +4 -4
  2. data/.rspec +0 -1
  3. data/.rubocop.yml +31 -38
  4. data/.ruby-version +1 -0
  5. data/.travis.yml +9 -19
  6. data/CHANGES.md +94 -42
  7. data/Gemfile +11 -3
  8. data/Guardfile +10 -0
  9. data/LICENSE.txt +1 -1
  10. data/README.md +43 -136
  11. data/Rakefile +2 -0
  12. data/examples/echo_server.rb +1 -0
  13. data/ext/libev/Changes +9 -13
  14. data/ext/libev/ev.c +100 -74
  15. data/ext/libev/ev.h +4 -9
  16. data/ext/libev/ev_epoll.c +6 -3
  17. data/ext/libev/ev_kqueue.c +8 -4
  18. data/ext/libev/ev_poll.c +6 -3
  19. data/ext/libev/ev_port.c +8 -4
  20. data/ext/libev/ev_select.c +4 -2
  21. data/ext/nio4r/bytebuffer.c +265 -257
  22. data/ext/nio4r/extconf.rb +3 -9
  23. data/ext/nio4r/monitor.c +93 -46
  24. data/ext/nio4r/nio4r.h +6 -16
  25. data/ext/nio4r/org/nio4r/ByteBuffer.java +193 -209
  26. data/ext/nio4r/org/nio4r/Monitor.java +164 -0
  27. data/ext/nio4r/org/nio4r/Nio4r.java +13 -391
  28. data/ext/nio4r/org/nio4r/Selector.java +278 -0
  29. data/ext/nio4r/selector.c +72 -64
  30. data/lib/nio.rb +3 -3
  31. data/lib/nio/bytebuffer.rb +179 -132
  32. data/lib/nio/monitor.rb +64 -4
  33. data/lib/nio/selector.rb +36 -13
  34. data/lib/nio/version.rb +1 -1
  35. data/nio4r.gemspec +25 -19
  36. data/spec/nio/acceptables_spec.rb +6 -4
  37. data/spec/nio/bytebuffer_spec.rb +323 -51
  38. data/spec/nio/monitor_spec.rb +122 -79
  39. data/spec/nio/selectables/pipe_spec.rb +5 -1
  40. data/spec/nio/selectables/ssl_socket_spec.rb +15 -12
  41. data/spec/nio/selectables/tcp_socket_spec.rb +42 -31
  42. data/spec/nio/selectables/udp_socket_spec.rb +2 -0
  43. data/spec/nio/selector_spec.rb +10 -4
  44. data/spec/spec_helper.rb +24 -3
  45. data/spec/support/selectable_examples.rb +7 -5
  46. data/tasks/extension.rake +2 -0
  47. data/tasks/rspec.rake +2 -0
  48. data/tasks/rubocop.rake +2 -0
  49. metadata +18 -15
  50. data/.rubocop_todo.yml +0 -35
data/spec/spec_helper.rb CHANGED
@@ -1,9 +1,30 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require "coveralls"
2
4
  Coveralls.wear!
3
5
 
4
- require "rubygems"
5
- require "bundler/setup"
6
6
  require "nio"
7
7
  require "support/selectable_examples"
8
+ require "rspec/retry"
9
+
10
+ RSpec.configure do |config|
11
+ config.disable_monkey_patching!
12
+ config.verbose_retry = true
13
+ config.display_try_failure_messages = true
14
+ end
15
+
16
+ $current_tcp_port = 10_000
17
+
18
+ def next_available_tcp_port
19
+ loop do
20
+ $current_tcp_port += 1
21
+
22
+ begin
23
+ sock = Timeout.timeout(1) { TCPSocket.new("localhost", $current_tcp_port) }
24
+ rescue Errno::ECONNREFUSED
25
+ break $current_tcp_port
26
+ end
8
27
 
9
- RSpec.configure(&:disable_monkey_patching!)
28
+ sock.close
29
+ end
30
+ end
@@ -1,7 +1,9 @@
1
+ # frozen_string_literal: true
2
+
1
3
  RSpec.shared_context "an NIO selectable" do
2
4
  let(:selector) { NIO::Selector.new }
3
5
 
4
- it "selects readable objects" do
6
+ it "selects readable objects", retry: 5 do # retry: Flaky on OS X
5
7
  monitor = selector.register(readable_subject, :r)
6
8
  ready = selector.select(0)
7
9
  expect(ready).to be_an Enumerable
@@ -9,7 +11,7 @@ RSpec.shared_context "an NIO selectable" do
9
11
  end
10
12
 
11
13
  it "does not select unreadable objects" do
12
- monitor = selector.register(unreadable_subject, :r)
14
+ selector.register(unreadable_subject, :r)
13
15
  expect(selector.select(0)).to be_nil
14
16
  end
15
17
 
@@ -21,7 +23,7 @@ RSpec.shared_context "an NIO selectable" do
21
23
  end
22
24
 
23
25
  it "does not select unwritable objects" do
24
- monitor = selector.register(unwritable_subject, :w)
26
+ selector.register(unwritable_subject, :w)
25
27
  expect(selector.select(0)).to be_nil
26
28
  end
27
29
  end
@@ -49,8 +51,8 @@ RSpec.shared_context "an NIO bidirectional stream" do
49
51
  let(:stream) { pair.first }
50
52
  let(:peer) { pair.last }
51
53
 
52
- it "selects readable and writable" do
53
- monitor = selector.register(readable_subject, :rw)
54
+ it "selects readable and writable", retry: 5 do # retry: Flaky on OS X
55
+ selector.register(readable_subject, :rw)
54
56
  selector.select(0) do |m|
55
57
  expect(m.readiness).to eq(:rw)
56
58
  end
data/tasks/extension.rake CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  if defined? JRUBY_VERSION
2
4
  require "rake/javaextensiontask"
3
5
  Rake::JavaExtensionTask.new("nio4r_ext") do |ext|
data/tasks/rspec.rake CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require "rspec/core/rake_task"
2
4
 
3
5
  RSpec::Core::RakeTask.new
data/tasks/rubocop.rake CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require "rubocop/rake_task"
2
4
 
3
5
  RuboCop::RakeTask.new
metadata CHANGED
@@ -1,23 +1,23 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nio4r
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0.pre
4
+ version: 2.1.0
5
5
  platform: java
6
6
  authors:
7
7
  - Tony Arcieri
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-11-05 00:00:00.000000000 Z
11
+ date: 2017-05-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake
15
- version_requirements: !ruby/object:Gem::Requirement
15
+ requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
19
  version: '0'
20
- requirement: !ruby/object:Gem::Requirement
20
+ version_requirements: !ruby/object:Gem::Requirement
21
21
  requirements:
22
22
  - - ">="
23
23
  - !ruby/object:Gem::Version
@@ -26,21 +26,21 @@ dependencies:
26
26
  type: :development
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: bundler
29
- version_requirements: !ruby/object:Gem::Requirement
29
+ requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - ">="
32
32
  - !ruby/object:Gem::Version
33
33
  version: '0'
34
- requirement: !ruby/object:Gem::Requirement
34
+ version_requirements: !ruby/object:Gem::Requirement
35
35
  requirements:
36
36
  - - ">="
37
37
  - !ruby/object:Gem::Version
38
38
  version: '0'
39
39
  prerelease: false
40
40
  type: :development
41
- description: New IO for Ruby
41
+ description: Cross-platform asynchronous I/O primitives for scalable network clients and servers. Inspired by the Java NIO API, but simplified for ease-of-use.
42
42
  email:
43
- - tony.arcieri@gmail.com
43
+ - bascule@gmail.com
44
44
  executables: []
45
45
  extensions: []
46
46
  extra_rdoc_files: []
@@ -48,10 +48,11 @@ files:
48
48
  - ".gitignore"
49
49
  - ".rspec"
50
50
  - ".rubocop.yml"
51
- - ".rubocop_todo.yml"
51
+ - ".ruby-version"
52
52
  - ".travis.yml"
53
53
  - CHANGES.md
54
54
  - Gemfile
55
+ - Guardfile
55
56
  - LICENSE.txt
56
57
  - README.md
57
58
  - Rakefile
@@ -78,7 +79,9 @@ files:
78
79
  - ext/nio4r/nio4r.h
79
80
  - ext/nio4r/nio4r_ext.c
80
81
  - ext/nio4r/org/nio4r/ByteBuffer.java
82
+ - ext/nio4r/org/nio4r/Monitor.java
81
83
  - ext/nio4r/org/nio4r/Nio4r.java
84
+ - ext/nio4r/org/nio4r/Selector.java
82
85
  - ext/nio4r/selector.c
83
86
  - lib/nio.rb
84
87
  - lib/nio/bytebuffer.rb
@@ -101,7 +104,7 @@ files:
101
104
  - tasks/extension.rake
102
105
  - tasks/rspec.rake
103
106
  - tasks/rubocop.rake
104
- homepage: https://github.com/celluloid/nio4r
107
+ homepage: https://github.com/socketry/nio4r
105
108
  licenses:
106
109
  - MIT
107
110
  metadata: {}
@@ -113,18 +116,18 @@ required_ruby_version: !ruby/object:Gem::Requirement
113
116
  requirements:
114
117
  - - ">="
115
118
  - !ruby/object:Gem::Version
116
- version: '0'
119
+ version: 2.2.2
117
120
  required_rubygems_version: !ruby/object:Gem::Requirement
118
121
  requirements:
119
- - - ">"
122
+ - - ">="
120
123
  - !ruby/object:Gem::Version
121
- version: 1.3.1
124
+ version: '0'
122
125
  requirements: []
123
126
  rubyforge_project:
124
- rubygems_version: 2.4.8
127
+ rubygems_version: 2.6.8
125
128
  signing_key:
126
129
  specification_version: 4
127
- summary: NIO provides a high performance selector API for monitoring IO objects
130
+ summary: New IO for Ruby
128
131
  test_files:
129
132
  - spec/nio/acceptables_spec.rb
130
133
  - spec/nio/bytebuffer_spec.rb
data/.rubocop_todo.yml DELETED
@@ -1,35 +0,0 @@
1
- # This configuration was generated by `rubocop --auto-gen-config`
2
- # on 2015-04-24 03:08:21 -0700 using RuboCop version 0.30.1.
3
- # The point is for the user to remove these configuration records
4
- # one by one as the offenses are removed from the code base.
5
- # Note that changes in the inspected code, or installation of new
6
- # versions of RuboCop, may require this file to be generated again.
7
-
8
- # Offense count: 2
9
- Lint/HandleExceptions:
10
- Enabled: false
11
-
12
- # Offense count: 3
13
- Lint/Loop:
14
- Enabled: false
15
-
16
- # Offense count: 1
17
- Lint/NonLocalExitFromIterator:
18
- Enabled: false
19
-
20
- # Offense count: 7
21
- Lint/UselessAssignment:
22
- Enabled: false
23
-
24
- # Offense count: 1
25
- # Configuration parameters: SupportedStyles, IndentOneStep.
26
- Style/CaseIndentation:
27
- IndentWhenRelativeTo: end
28
-
29
- # Offense count: 1
30
- Style/Documentation:
31
- Enabled: false
32
-
33
- # Offense count: 2
34
- Style/RescueModifier:
35
- Enabled: false