celluloid-io 0.16.2 → 0.16.5.pre0

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: 478d600640a4868162a199bc7db4ac8926be40f2
4
- data.tar.gz: d0cc206f1aeb05290be388ba6fc0e66375bd179f
3
+ metadata.gz: bf0058f46b15fb91d5363861cc8035e0f41f6396
4
+ data.tar.gz: cad3855d8ca89f73731dceaa18716ba25f315484
5
5
  SHA512:
6
- metadata.gz: 244c3a718d4e0237682640dd2e4005fbf254893f0c12441efc7cab19de65585ac4e14a8b99e7e11cf796c4c8cf1e18dc60cab259787b0fabffaa306fa73d240c
7
- data.tar.gz: 09a0bbc5a409bde43ada45ac692467a9702d98d79f45e27d63ddcc6586e682cb3ff0d067e1e764e1b06a839de37d849d35efb05db9b0c6304a18aee63c02c994
6
+ metadata.gz: 39ce8ad8e39920264f26c199bf14e5dbd03c6e97943d7d5a636e68d6e9cc687aa79d14b3d6542ff5af8e11eb19e118e8ff3b262fd61966c89814d3966bcfc0fb
7
+ data.tar.gz: 03ffeaedee0b08276537ff5cfedf5d11157c34c932129f1c394626ff45923b93867901bb67f2718e5fe6b032649dd7112d910c527c983e82b1c8c6c7c532f026
data/.env-ci ADDED
@@ -0,0 +1,4 @@
1
+ CELLULOID_SPECS_LOG_STRATEGY=stderr
2
+ CELLULOID_SPECS_LOG_LEVEL=3
3
+ CELLULOID_SPECS_LOG_FILE=log/ci.log
4
+ CELLULOID_SPECS_LOG_SYNC=false
data/.env-dev ADDED
@@ -0,0 +1,4 @@
1
+ CELLULOID_SPECS_LOG_STRATEGY=single
2
+ CELLULOID_SPECS_LOG_FILE=log/test.log
3
+ CELLULOID_SPECS_LOG_LEVEL=0
4
+ CELLULOID_SPECS_LOG_SYNC=true
data/.gitmodules ADDED
@@ -0,0 +1,3 @@
1
+ [submodule "culture"]
2
+ path = culture
3
+ url = http://github.com/celluloid/culture.git
data/.travis.yml CHANGED
@@ -1,19 +1,35 @@
1
1
  script: rake ci
2
+ language: ruby
2
3
  rvm:
3
- - 1.9.3
4
- - 2.0.0
5
- - 2.1.1
6
- - ruby-head
4
+ - 2.2.0
5
+ - 2.2.2
7
6
  - jruby
7
+ - ruby-head
8
8
  - jruby-head
9
9
  - rbx-2
10
10
 
11
+ # TODO: Put these back:
12
+ # * CELLULOID_TASK_CLASS=Fibered
13
+ # * CELLULOID_TASK_CLASS=Threaded
14
+ # For right now the imporant thing is to test BACKPORTED mode:
15
+
11
16
  matrix:
17
+ fast_finish: true
12
18
  allow_failures:
19
+ - rvm: rbx-2
13
20
  - rvm: ruby-head
14
- - rvm: jruby
15
21
  - rvm: jruby-head
16
- - rvm: rbx-2
22
+ - env: CELLULOID_BACKPORTED=true
23
+
24
+ env:
25
+ matrix:
26
+ - CELLULOID_BACKPORTED=true
27
+ - CELLULOID_BACKPORTED=false
28
+ global:
29
+ - NUMBER_OF_PROCESSORS=2 CELLULOID_CONFIG_FILE=.env-ci
17
30
 
18
31
  notifications:
19
32
  irc: "irc.freenode.org#celluloid"
33
+
34
+ sudo: false
35
+ install: bundle install --without=development
data/CHANGES.md CHANGED
@@ -1,21 +1,25 @@
1
- 0.16.2 (2014-01-30)
2
- -------------------
1
+ HEAD
2
+ -----
3
+ * Adjust class name for Celluloid::Mailbox::Evented, per 0.17.0 of Celluloid.
4
+
5
+ 0.16.2 (2015-01-30)
6
+ -----
3
7
  * More TCPSocket compatibility fixes
4
8
  * Ensure monitors are closed when tasks resume
5
9
  * Fix Errno::EAGAIN handling in Stream#syswrite
6
10
 
7
11
  0.16.1 (2014-10-08)
8
- -------------------
12
+ -----
9
13
  * Revert read/write interest patch as it caused file descriptor leaks
10
14
 
11
15
  0.16.0 (2014-09-04)
12
- -------------------
16
+ -----
13
17
  * Fix bug handling simultaneous read/write interests
14
18
  * Use Resolv::DNS::Config to obtain nameservers
15
19
  * Celluloid::IO.copy_stream support (uses a background thread)
16
20
 
17
21
  0.15.0 (2013-09-04)
18
- -------------------
22
+ -----
19
23
  * Improved DNS resolver with less NIH and more Ruby stdlib goodness
20
24
  * Better match Ruby stdlib TCPServer API
21
25
  * Add missing #send and #recv on Celluloid::IO::TCPSocket
@@ -23,16 +27,16 @@
23
27
  * Add missing #peeraddr method on Celluloid::IO::SSLSocket
24
28
 
25
29
  0.14.0 (2013-05-07)
26
- -------------------
30
+ -----
27
31
  * Add `close_read`/`close_write` delegates for rack-hijack support
28
32
  * Depend on EventedMailbox from core
29
33
 
30
34
  0.13.1
31
- ------
35
+ -----
32
36
  * Remove overhead for `wait_readable`/`wait_writable`
33
37
 
34
38
  0.13.0
35
- ------
39
+ -----
36
40
  * Support for many, many more IO methods, particularly line-oriented
37
41
  methods like #gets, #readline, and #readlines
38
42
  * Initial SSL support via Celluloid::IO::SSLSocket and
@@ -42,15 +46,15 @@
42
46
  * Celluloid 0.13 compatibility fixes
43
47
 
44
48
  0.12.0
45
- ------
49
+ -----
46
50
  * Tracking release for Celluloid 0.12.0
47
51
 
48
52
  0.11.0
49
- ------
53
+ -----
50
54
  * "Unofficial" SSL support (via nio4r 0.4.0)
51
55
 
52
56
  0.10.0
53
- ------
57
+ -----
54
58
  * Read/write operations are now atomic across tasks
55
59
  * True non-blocking connect support
56
60
  * Non-blocking DNS resolution support
data/Gemfile CHANGED
@@ -1,5 +1,2 @@
1
- source 'https://rubygems.org'
2
- gemspec
3
-
4
- gem 'coveralls', require: false
5
- gem 'celluloid', github: 'celluloid/celluloid', branch: 'master'
1
+ require File.expand_path("../culture/sync", __FILE__)
2
+ Celluloid::Sync::Gemfile[self]
data/celluloid-io.gemspec CHANGED
@@ -1,5 +1,5 @@
1
1
  # -*- encoding: utf-8 -*-
2
- require File.expand_path('../lib/celluloid/io/version', __FILE__)
2
+ require File.expand_path("../culture/sync", __FILE__)
3
3
 
4
4
  Gem::Specification.new do |gem|
5
5
  gem.name = "celluloid-io"
@@ -16,12 +16,10 @@ Gem::Specification.new do |gem|
16
16
  gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
17
17
  gem.require_paths = ["lib"]
18
18
 
19
- gem.add_dependency 'celluloid', '>= 0.16.0'
19
+ Celluloid::Sync::Gemspec[gem]
20
+
20
21
  gem.add_dependency 'nio4r', '>= 1.1.0'
21
22
 
22
- gem.add_development_dependency 'rake'
23
- gem.add_development_dependency 'rspec', '~> 2.14.0'
24
- gem.add_development_dependency 'benchmark_suite'
25
23
  gem.add_development_dependency 'guard-rspec'
26
24
  gem.add_development_dependency 'rb-fsevent', '~> 0.9.1' if RUBY_PLATFORM =~ /darwin/
27
25
  end
@@ -1,7 +1,7 @@
1
1
  module Celluloid
2
2
  module IO
3
3
  # An alternative implementation of Celluloid::Mailbox using Reactor
4
- class Mailbox < Celluloid::EventedMailbox
4
+ class Mailbox < Celluloid::Mailbox::Evented
5
5
  def initialize
6
6
  super(Reactor)
7
7
  end
@@ -6,13 +6,26 @@ module Celluloid
6
6
  class SSLSocket < Stream
7
7
  extend Forwardable
8
8
 
9
- def_delegators :@socket, :read_nonblock, :write_nonblock, :close, :closed?,
10
- :cert, :cipher, :client_ca, :peer_cert, :peer_cert_chain, :verify_result, :peeraddr
9
+ def_delegators :@socket,
10
+ :read_nonblock,
11
+ :write_nonblock,
12
+ :close,
13
+ :closed?,
14
+ :cert,
15
+ :cipher,
16
+ :client_ca,
17
+ :peeraddr,
18
+ :peer_cert,
19
+ :peer_cert_chain,
20
+ :post_connection_check,
21
+ :verify_result,
22
+ :sync_close=
11
23
 
12
24
  def initialize(io, ctx = OpenSSL::SSL::SSLContext.new)
13
25
  super()
14
26
  @context = ctx
15
27
  @socket = OpenSSL::SSL::SSLSocket.new(::IO.try_convert(io), @context)
28
+ @socket.sync_close = true if @socket.respond_to?(:sync_close=)
16
29
  end
17
30
 
18
31
  def connect
@@ -80,13 +80,15 @@ module Celluloid
80
80
 
81
81
  begin
82
82
  @socket.connect_nonblock Socket.sockaddr_in(remote_port, @addr.to_s)
83
- rescue Errno::EINPROGRESS
83
+ rescue Errno::EINPROGRESS, Errno::EALREADY
84
+ # JRuby raises EINPROGRESS, MRI raises EALREADY
85
+
84
86
  wait_writable
85
87
 
86
88
  # HAX: for some reason we need to finish_connect ourselves on JRuby
87
89
  # This logic is unnecessary but JRuby still throws Errno::EINPROGRESS
88
90
  # if we retry the non-blocking connect instead of just finishing it
89
- retry unless defined?(JRUBY_VERSION) && @socket.to_channel.finish_connect
91
+ retry unless RUBY_PLATFORM == 'java' && @socket.to_channel.finish_connect
90
92
  rescue Errno::EISCONN
91
93
  # We're now connected! Yay exceptions for flow control
92
94
  # NOTE: This is the approach the Ruby stdlib docs suggest ;_;
@@ -1,5 +1,5 @@
1
1
  module Celluloid
2
2
  module IO
3
- VERSION = "0.16.2"
3
+ VERSION = "0.16.5.pre0"
4
4
  end
5
5
  end
@@ -5,14 +5,14 @@ describe Celluloid::IO::DNSResolver do
5
5
  it 'resolves hostnames statically from hosts file without nameservers' do
6
6
  # /etc/resolv.conf doesn't exist on Mac OSX when no networking is
7
7
  # disabled, thus .nameservers would return nil
8
- Celluloid::IO::DNSResolver.should_receive(:nameservers).at_most(:once) { nil }
8
+ expect(Celluloid::IO::DNSResolver).to receive(:nameservers).at_most(:once) { nil }
9
9
  resolver = Celluloid::IO::DNSResolver.new
10
- resolver.resolve('localhost').should eq Resolv::IPv4.create("127.0.0.1")
10
+ expect(resolver.resolve('localhost')).to eq Resolv::IPv4.create("127.0.0.1")
11
11
  end
12
12
 
13
13
  it 'resolves hostnames' do
14
14
  resolver = Celluloid::IO::DNSResolver.new
15
- resolver.resolve('localhost').should eq Resolv::IPv4.create("127.0.0.1")
15
+ expect(resolver.resolve('localhost')).to eq Resolv::IPv4.create("127.0.0.1")
16
16
  end
17
17
 
18
18
  it "resolves domain names" do
@@ -26,17 +26,17 @@ describe Celluloid::IO::DNSResolver do
26
26
  resolver = Celluloid::IO::DNSResolver.new
27
27
  results = resolver.resolve("www.google.com")
28
28
  if results.is_a?(Array)
29
- results.all? {|i| i.should be_an_instance_of(Resolv::IPv4) }
29
+ results.all? {|i| expect(i).to be_an_instance_of(Resolv::IPv4) }
30
30
  else
31
- results.should be_an_instance_of(Resolv::IPv4)
31
+ expect(results).to be_an_instance_of(Resolv::IPv4)
32
32
  end
33
33
  # www.yahoo.com will be resolved randomly whether multiple or
34
34
  # single entry.
35
35
  results = resolver.resolve("www.yahoo.com")
36
36
  if results.is_a?(Array)
37
- results.all? {|i| i.should be_an_instance_of(Resolv::IPv4) }
37
+ results.all? {|i| expect(i).to be_an_instance_of(Resolv::IPv4) }
38
38
  else
39
- results.should be_an_instance_of(Resolv::IPv4)
39
+ expect(results).to be_an_instance_of(Resolv::IPv4)
40
40
  end
41
41
  end
42
42
  end
@@ -29,7 +29,7 @@ describe Celluloid::IO::Reactor do
29
29
  end
30
30
  end
31
31
 
32
- expect(handle).to be_true
32
+ expect(handle).to be_truthy
33
33
 
34
34
  server.close
35
35
  peer.close
@@ -25,7 +25,7 @@ describe Celluloid::IO::SSLServer do
25
25
  context "inside Celluloid::IO" do
26
26
  it "should be evented" do
27
27
  with_ssl_server do |subject|
28
- within_io_actor { Celluloid::IO.evented? }.should be_true
28
+ expect(within_io_actor { Celluloid::IO.evented? }).to be_truthy
29
29
  end
30
30
  end
31
31
 
@@ -36,11 +36,11 @@ describe Celluloid::IO::SSLServer do
36
36
  OpenSSL::SSL::SSLSocket.new(raw, client_context).connect
37
37
  end
38
38
  peer = within_io_actor { subject.accept }
39
- peer.should be_a Celluloid::IO::SSLSocket
39
+ expect(peer).to be_a Celluloid::IO::SSLSocket
40
40
 
41
41
  client = thread.value
42
42
  client.write payload
43
- peer.read(payload.size).should eq payload
43
+ expect(peer.read(payload.size)).to eq payload
44
44
  end
45
45
  end
46
46
  end
@@ -48,7 +48,7 @@ describe Celluloid::IO::SSLServer do
48
48
  context "outside Celluloid::IO" do
49
49
  it "should be blocking" do
50
50
  with_ssl_server do |subject|
51
- Celluloid::IO.should_not be_evented
51
+ expect(Celluloid::IO).not_to be_evented
52
52
  end
53
53
  end
54
54
 
@@ -59,11 +59,11 @@ describe Celluloid::IO::SSLServer do
59
59
  OpenSSL::SSL::SSLSocket.new(raw, client_context).connect
60
60
  end
61
61
  peer = subject.accept
62
- peer.should be_a Celluloid::IO::SSLSocket
62
+ expect(peer).to be_a Celluloid::IO::SSLSocket
63
63
 
64
64
  client = thread.value
65
65
  client.write payload
66
- peer.read(payload.size).should eq payload
66
+ expect(peer.read(payload.size)).to eq payload
67
67
  end
68
68
  end
69
69
  end
@@ -73,7 +73,7 @@ describe Celluloid::IO::SSLServer do
73
73
  it "should auto-wrap a raw ::TCPServer" do
74
74
  raw_server = ::TCPServer.new(example_addr, example_ssl_port)
75
75
  with_ssl_server(raw_server) do |ssl_server|
76
- ssl_server.tcp_server.class.should == Celluloid::IO::TCPServer
76
+ expect(ssl_server.tcp_server.class).to eq(Celluloid::IO::TCPServer)
77
77
  end
78
78
  end
79
79
  end
@@ -72,35 +72,38 @@ describe Celluloid::IO::SSLSocket do
72
72
  with_ssl_sockets do |ssl_client, ssl_peer|
73
73
  within_io_actor do
74
74
  ssl_peer << request
75
- ssl_client.read(request.size).should eq(request)
75
+ expect(ssl_client.read(request.size)).to eq(request)
76
76
 
77
77
  ssl_client << response
78
- ssl_peer.read(response.size).should eq(response)
78
+ expect(ssl_peer.read(response.size)).to eq(response)
79
79
  end
80
80
  end
81
81
  end
82
82
 
83
83
  it "starts SSL on a connected TCP socket" do
84
- pending "JRuby support" if defined?(JRUBY_VERSION)
84
+ if RUBY_PLATFORM == 'java'
85
+ pending "JRuby support"
86
+ fail "Bypassing potential deadlock."
87
+ end
85
88
  with_raw_sockets do |client, peer|
86
89
  within_io_actor do
87
90
  peer << request
88
- client.read(request.size).should eq(request)
91
+ expect(client.read(request.size)).to eq(request)
89
92
 
90
93
  client << response
91
- peer.read(response.size).should eq(response)
94
+ expect(peer.read(response.size)).to eq(response)
92
95
 
93
96
  # now that we've written bytes, upgrade to SSL
94
97
  client_thread = Thread.new { OpenSSL::SSL::SSLSocket.new(client).connect }
95
98
  ssl_peer = Celluloid::IO::SSLSocket.new peer, server_context
96
- ssl_peer.should eq(ssl_peer.accept)
99
+ expect(ssl_peer).to eq(ssl_peer.accept)
97
100
  ssl_client = client_thread.value
98
101
 
99
102
  ssl_peer << request
100
- ssl_client.read(request.size).should eq(request)
103
+ expect(ssl_client.read(request.size)).to eq(request)
101
104
 
102
105
  ssl_client << response
103
- ssl_peer.read(response.size).should eq(response)
106
+ expect(ssl_peer.read(response.size)).to eq(response)
104
107
  end
105
108
  end
106
109
  end
@@ -110,80 +113,83 @@ describe Celluloid::IO::SSLSocket do
110
113
  it "connects to SSL servers over TCP" do
111
114
  with_ssl_sockets do |ssl_client, ssl_peer|
112
115
  ssl_peer << request
113
- ssl_client.read(request.size).should eq(request)
116
+ expect(ssl_client.read(request.size)).to eq(request)
114
117
 
115
118
  ssl_client << response
116
- ssl_peer.read(response.size).should eq(response)
119
+ expect(ssl_peer.read(response.size)).to eq(response)
117
120
  end
118
121
  end
119
122
 
120
123
  it "starts SSL on a connected TCP socket" do
121
- pending "JRuby support" if defined?(JRUBY_VERSION)
124
+ if RUBY_PLATFORM == 'java'
125
+ pending "JRuby support"
126
+ fail "Bypassing potential deadlock."
127
+ end
122
128
  with_raw_sockets do |client, peer|
123
129
  peer << request
124
- client.read(request.size).should eq(request)
130
+ expect(client.read(request.size)).to eq(request)
125
131
 
126
132
  client << response
127
- peer.read(response.size).should eq(response)
133
+ expect(peer.read(response.size)).to eq(response)
128
134
 
129
135
  # now that we've written bytes, upgrade to SSL
130
136
  client_thread = Thread.new { OpenSSL::SSL::SSLSocket.new(client).connect }
131
137
  ssl_peer = Celluloid::IO::SSLSocket.new peer, server_context
132
- ssl_peer.should eq(ssl_peer.accept)
138
+ expect(ssl_peer).to eq(ssl_peer.accept)
133
139
  ssl_client = client_thread.value
134
140
 
135
141
  ssl_peer << request
136
- ssl_client.read(request.size).should eq(request)
142
+ expect(ssl_client.read(request.size)).to eq(request)
137
143
 
138
144
  ssl_client << response
139
- ssl_peer.read(response.size).should eq(response)
145
+ expect(ssl_peer.read(response.size)).to eq(response)
140
146
  end
141
147
  end
142
148
  end
143
149
 
144
150
  it "knows its cert" do
145
151
  # FIXME: seems bad? o_O
146
- pending "wtf is wrong with this on JRuby" if defined? JRUBY_VERSION
152
+ pending "wtf is wrong with this on JRuby" if RUBY_PLATFORM == 'java'
147
153
  with_ssl_sockets do |ssl_client|
148
- ssl_client.cert.to_der.should eq(client_cert.to_der)
154
+ expect(ssl_client.cert.to_der).to eq(client_cert.to_der)
149
155
  end
150
156
  end
151
157
 
152
158
  it "knows its peer_cert" do
153
159
  with_ssl_sockets do |ssl_client|
154
- ssl_client.peer_cert.to_der.should eq(ssl_client.to_io.peer_cert.to_der)
160
+ expect(ssl_client.peer_cert.to_der).to eq(ssl_client.to_io.peer_cert.to_der)
155
161
  end
156
162
  end
157
163
 
158
164
  it "knows its peer_cert_chain" do
159
165
  with_ssl_sockets do |ssl_client|
160
- ssl_client.peer_cert_chain.zip(ssl_client.to_io.peer_cert_chain).map do |c1, c2|
166
+ expect(ssl_client.peer_cert_chain.zip(ssl_client.to_io.peer_cert_chain).map do |c1, c2|
161
167
  c1.to_der == c2.to_der
162
- end.should be_all
168
+ end).to be_all
163
169
  end
164
170
  end
165
171
 
166
172
  it "knows its cipher" do
167
173
  with_ssl_sockets do |ssl_client|
168
- ssl_client.cipher.should eq(ssl_client.to_io.cipher)
174
+ expect(ssl_client.cipher).to eq(ssl_client.to_io.cipher)
169
175
  end
170
176
  end
171
177
 
172
178
  it "knows its client_ca" do
173
179
  # jruby-openssl does not implement this method
174
- pending "jruby-openssl support" if defined? JRUBY_VERSION
180
+ pending "jruby-openssl support" if RUBY_PLATFORM == 'java'
175
181
 
176
182
  with_ssl_sockets do |ssl_client|
177
- ssl_client.client_ca.should eq(ssl_client.to_io.client_ca)
183
+ expect(ssl_client.client_ca).to eq(ssl_client.to_io.client_ca)
178
184
  end
179
185
  end
180
186
 
181
187
  it "verifies peer certificates" do
182
188
  # FIXME: JRuby seems to be giving the wrong result here o_O
183
- pending "jruby-openssl support" if defined? JRUBY_VERSION
189
+ pending "jruby-openssl support" if RUBY_PLATFORM == 'java'
184
190
 
185
191
  with_ssl_sockets do |ssl_client, ssl_peer|
186
- ssl_client.verify_result.should eq(OpenSSL::X509::V_ERR_DEPTH_ZERO_SELF_SIGNED_CERT)
192
+ expect(ssl_client.verify_result).to eq(OpenSSL::X509::V_ERR_DEPTH_ZERO_SELF_SIGNED_CERT)
187
193
  end
188
194
  end
189
195