celluloid-io 0.13.1 → 0.14.0.pre
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/CHANGES.md +0 -5
- data/Gemfile +1 -1
- data/README.md +0 -1
- data/examples/echo_server.rb +1 -0
- data/examples/echo_unix_client.rb +2 -1
- data/examples/echo_unix_server.rb +3 -2
- data/lib/celluloid/io.rb +11 -6
- data/lib/celluloid/io/mailbox.rb +3 -73
- data/lib/celluloid/io/ssl_server.rb +1 -1
- data/lib/celluloid/io/stream.rb +8 -8
- data/lib/celluloid/io/tcp_server.rb +0 -6
- data/lib/celluloid/io/tcp_socket.rb +1 -1
- data/lib/celluloid/io/udp_socket.rb +0 -6
- data/lib/celluloid/io/unix_server.rb +0 -6
- data/lib/celluloid/io/version.rb +1 -1
- data/spec/celluloid/io/ssl_server_spec.rb +4 -4
- data/spec/celluloid/io/ssl_socket_spec.rb +21 -19
- data/spec/celluloid/io/tcp_server_spec.rb +2 -2
- data/spec/celluloid/io/tcp_socket_spec.rb +3 -2
- data/spec/celluloid/io/udp_socket_spec.rb +6 -4
- data/spec/celluloid/io/unix_server_spec.rb +2 -2
- data/spec/celluloid/io/unix_socket_spec.rb +2 -2
- data/spec/spec_helper.rb +10 -0
- metadata +20 -37
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 254d0a9575a6c73e8ef8f797a4fe8097857a51b3
|
4
|
+
data.tar.gz: 0b8068ae30da210730735944d34c3140463b3946
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 37e40fac8272a4ac1890d36dbab41ba11a90405fa36bea9275cfbe2b31c678f61b634a5ca4bfea0b3dbe0f5968a875283cab1f08e4a6870ba5983b366cbb2a71
|
7
|
+
data.tar.gz: b126f30e30822caf88f8582b63eeb2ed0d1891821b8ffc81d6d60291360be709b3e76c6db6e2c632f7203da965847dcbfb0dab59eb076aebe2f85528a439c25a
|
data/CHANGES.md
CHANGED
@@ -1,8 +1,3 @@
|
|
1
|
-
0.13.1 (2013-04-04)
|
2
|
-
-------------------
|
3
|
-
* Fix major performance regression: I/O backpressure (i.e. EAGAIN
|
4
|
-
handling) was being double-dispatched through the actor protocol.
|
5
|
-
|
6
1
|
0.13.0
|
7
2
|
------
|
8
3
|
* Support for many, many more IO methods, particularly line-oriented
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -2,7 +2,6 @@
|
|
2
2
|
================
|
3
3
|
[![Gem Version](https://badge.fury.io/rb/celluloid-io.png)](http://rubygems.org/gems/celluloid-io)
|
4
4
|
[![Build Status](https://secure.travis-ci.org/celluloid/celluloid-io.png?branch=master)](http://travis-ci.org/celluloid/celluloid-io)
|
5
|
-
[![Dependency Status](https://gemnasium.com/celluloid/celluloid-io.png)](https://gemnasium.com/celluloid/celluloid-io)
|
6
5
|
[![Code Climate](https://codeclimate.com/github/celluloid/celluloid-io.png)](https://codeclimate.com/github/celluloid/celluloid-io)
|
7
6
|
[![Coverage Status](https://coveralls.io/repos/celluloid/celluloid-io/badge.png?branch=master)](https://coveralls.io/r/celluloid/celluloid-io)
|
8
7
|
|
data/examples/echo_server.rb
CHANGED
@@ -3,6 +3,7 @@ require 'celluloid/io'
|
|
3
3
|
|
4
4
|
class EchoUNIXClient
|
5
5
|
include Celluloid::IO
|
6
|
+
finalizer :finalize
|
6
7
|
|
7
8
|
def initialize(socket_path)
|
8
9
|
puts "*** connecting to #{socket_path}"
|
@@ -25,4 +26,4 @@ class EchoUNIXClient
|
|
25
26
|
end
|
26
27
|
|
27
28
|
c = EchoUNIXClient.new("/tmp/sock_test")
|
28
|
-
c.echo("DATA")
|
29
|
+
c.echo("DATA")
|
@@ -3,7 +3,8 @@ require 'celluloid/io'
|
|
3
3
|
|
4
4
|
class EchoUNIXServer
|
5
5
|
include Celluloid::IO
|
6
|
-
|
6
|
+
finalizer :finalize
|
7
|
+
|
7
8
|
attr_reader :socket_path, :server
|
8
9
|
|
9
10
|
def initialize(socket_path)
|
@@ -23,7 +24,7 @@ class EchoUNIXServer
|
|
23
24
|
puts "*** gets data #{data}"
|
24
25
|
socket.write(data)
|
25
26
|
end
|
26
|
-
|
27
|
+
|
27
28
|
rescue EOFError
|
28
29
|
puts "*** disconnected"
|
29
30
|
|
data/lib/celluloid/io.rb
CHANGED
@@ -23,11 +23,16 @@ module Celluloid
|
|
23
23
|
klass.mailbox_class Celluloid::IO::Mailbox
|
24
24
|
end
|
25
25
|
|
26
|
+
def self.evented?
|
27
|
+
actor = Thread.current[:celluloid_actor]
|
28
|
+
actor && actor.mailbox.is_a?(Celluloid::IO::Mailbox)
|
29
|
+
end
|
30
|
+
|
26
31
|
def wait_readable(io)
|
27
32
|
io = io.to_io
|
28
|
-
|
29
|
-
|
30
|
-
|
33
|
+
if IO.evented?
|
34
|
+
mailbox = Thread.current[:celluloid_mailbox]
|
35
|
+
mailbox.reactor.wait_readable(io)
|
31
36
|
else
|
32
37
|
Kernel.select([io])
|
33
38
|
end
|
@@ -37,9 +42,9 @@ module Celluloid
|
|
37
42
|
|
38
43
|
def wait_writable(io)
|
39
44
|
io = io.to_io
|
40
|
-
|
41
|
-
|
42
|
-
|
45
|
+
if IO.evented?
|
46
|
+
mailbox = Thread.current[:celluloid_mailbox]
|
47
|
+
mailbox.reactor.wait_writable(io)
|
43
48
|
else
|
44
49
|
Kernel.select([], [io])
|
45
50
|
end
|
data/lib/celluloid/io/mailbox.rb
CHANGED
@@ -1,79 +1,9 @@
|
|
1
1
|
module Celluloid
|
2
2
|
module IO
|
3
3
|
# An alternative implementation of Celluloid::Mailbox using Reactor
|
4
|
-
class Mailbox < Celluloid::
|
5
|
-
|
6
|
-
|
7
|
-
def initialize(reactor = nil)
|
8
|
-
super()
|
9
|
-
# @condition won't be used in the class.
|
10
|
-
@reactor = reactor || Reactor.new
|
11
|
-
end
|
12
|
-
|
13
|
-
# Add a message to the Mailbox
|
14
|
-
def <<(message)
|
15
|
-
@mutex.lock
|
16
|
-
begin
|
17
|
-
if message.is_a?(SystemEvent)
|
18
|
-
# Silently swallow system events sent to dead actors
|
19
|
-
return if @dead
|
20
|
-
|
21
|
-
# SystemEvents are high priority messages so they get added to the
|
22
|
-
# head of our message queue instead of the end
|
23
|
-
@messages.unshift message
|
24
|
-
else
|
25
|
-
raise MailboxError, "dead recipient" if @dead
|
26
|
-
@messages << message
|
27
|
-
end
|
28
|
-
|
29
|
-
current_actor = Thread.current[:celluloid_actor]
|
30
|
-
@reactor.wakeup unless current_actor && current_actor.mailbox == self
|
31
|
-
rescue IOError
|
32
|
-
raise MailboxError, "dead recipient"
|
33
|
-
ensure
|
34
|
-
@mutex.unlock rescue nil
|
35
|
-
end
|
36
|
-
nil
|
37
|
-
end
|
38
|
-
|
39
|
-
# Receive a message from the Mailbox
|
40
|
-
def receive(timeout = nil, &block)
|
41
|
-
message = next_message(block)
|
42
|
-
|
43
|
-
until message
|
44
|
-
if timeout
|
45
|
-
now = Time.now
|
46
|
-
wait_until ||= now + timeout
|
47
|
-
wait_interval = wait_until - now
|
48
|
-
return if wait_interval < 0
|
49
|
-
else
|
50
|
-
wait_interval = nil
|
51
|
-
end
|
52
|
-
|
53
|
-
@reactor.run_once(wait_interval)
|
54
|
-
message = next_message(block)
|
55
|
-
end
|
56
|
-
|
57
|
-
message
|
58
|
-
rescue IOError
|
59
|
-
shutdown # force shutdown of the mailbox
|
60
|
-
raise MailboxShutdown, "mailbox shutdown called during receive"
|
61
|
-
end
|
62
|
-
|
63
|
-
# Obtain the next message from the mailbox that matches the given block
|
64
|
-
def next_message(block)
|
65
|
-
@mutex.lock
|
66
|
-
begin
|
67
|
-
super(&block)
|
68
|
-
ensure
|
69
|
-
@mutex.unlock rescue nil
|
70
|
-
end
|
71
|
-
end
|
72
|
-
|
73
|
-
# Cleanup any IO objects this Mailbox may be using
|
74
|
-
def shutdown
|
75
|
-
@reactor.shutdown
|
76
|
-
super
|
4
|
+
class Mailbox < Celluloid::EventedMailbox
|
5
|
+
def initialize
|
6
|
+
super(Reactor)
|
77
7
|
end
|
78
8
|
end
|
79
9
|
end
|
@@ -5,7 +5,7 @@ module Celluloid
|
|
5
5
|
# SSLServer wraps a TCPServer to provide immediate SSL accept
|
6
6
|
class SSLServer
|
7
7
|
extend Forwardable
|
8
|
-
def_delegators :@tcp_server, :listen, :shutdown, :close, :closed?, :to_io
|
8
|
+
def_delegators :@tcp_server, :listen, :shutdown, :close, :closed?, :to_io
|
9
9
|
|
10
10
|
attr_accessor :start_immediately
|
11
11
|
attr_reader :tcp_server
|
data/lib/celluloid/io/stream.rb
CHANGED
@@ -29,12 +29,6 @@ module Celluloid
|
|
29
29
|
@write_latch = Latch.new
|
30
30
|
end
|
31
31
|
|
32
|
-
# Are we inside of a Celluloid::IO actor?
|
33
|
-
def evented?
|
34
|
-
actor = Thread.current[:celluloid_actor]
|
35
|
-
actor && actor.mailbox.is_a?(Celluloid::IO::Mailbox)
|
36
|
-
end
|
37
|
-
|
38
32
|
# Wait until the current object is readable
|
39
33
|
def wait_readable; Celluloid::IO.wait_readable(self); end
|
40
34
|
|
@@ -195,7 +189,11 @@ module Celluloid
|
|
195
189
|
# See also #gets
|
196
190
|
def readlines(eol=$/)
|
197
191
|
ary = []
|
198
|
-
|
192
|
+
|
193
|
+
while line = self.gets(eol)
|
194
|
+
ary << line
|
195
|
+
end
|
196
|
+
|
199
197
|
ary
|
200
198
|
end
|
201
199
|
|
@@ -215,7 +213,9 @@ module Celluloid
|
|
215
213
|
|
216
214
|
# Calls the given block once for each byte in the stream.
|
217
215
|
def each_byte # :yields: byte
|
218
|
-
|
216
|
+
while c = getc
|
217
|
+
yield(c.ord)
|
218
|
+
end
|
219
219
|
end
|
220
220
|
|
221
221
|
# Reads a one-character string from the stream. Raises an EOFError at end
|
@@ -24,12 +24,6 @@ module Celluloid
|
|
24
24
|
@server
|
25
25
|
end
|
26
26
|
|
27
|
-
# Are we inside a Celluloid ::IO actor?
|
28
|
-
def evented?
|
29
|
-
actor = Thread.current[:celluloid_actor]
|
30
|
-
actor && actor.mailbox.is_a?(Celluloid::IO::Mailbox)
|
31
|
-
end
|
32
|
-
|
33
27
|
# Convert a Ruby TCPServer into a Celluloid::IO::TCPServer
|
34
28
|
def self.from_ruby_server(ruby_server)
|
35
29
|
server = allocate
|
@@ -7,7 +7,7 @@ module Celluloid
|
|
7
7
|
class TCPSocket < Stream
|
8
8
|
extend Forwardable
|
9
9
|
|
10
|
-
def_delegators :@socket, :read_nonblock, :write_nonblock, :close, :closed?
|
10
|
+
def_delegators :@socket, :read_nonblock, :write_nonblock, :close, :close_read, :close_write, :closed?
|
11
11
|
def_delegators :@socket, :addr, :peeraddr, :setsockopt
|
12
12
|
|
13
13
|
# Open a TCP socket, yielding it to the given block and closing it
|
@@ -9,12 +9,6 @@ module Celluloid
|
|
9
9
|
@socket = ::UDPSocket.new
|
10
10
|
end
|
11
11
|
|
12
|
-
# Are we inside of a Celluloid::IO actor?
|
13
|
-
def evented?
|
14
|
-
actor = Thread.current[:celluloid_actor]
|
15
|
-
actor && actor.mailbox.is_a?(Celluloid::IO::Mailbox)
|
16
|
-
end
|
17
|
-
|
18
12
|
# Wait until the socket is readable
|
19
13
|
def wait_readable; Celluloid::IO.wait_readable(self); end
|
20
14
|
|
data/lib/celluloid/io/version.rb
CHANGED
@@ -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 {
|
28
|
+
within_io_actor { Celluloid::IO.evented? }.should be_true
|
29
29
|
end
|
30
30
|
end
|
31
31
|
|
@@ -33,7 +33,7 @@ describe Celluloid::IO::SSLServer do
|
|
33
33
|
with_ssl_server do |subject|
|
34
34
|
thread = Thread.new do
|
35
35
|
raw = TCPSocket.new(example_addr, example_ssl_port)
|
36
|
-
|
36
|
+
OpenSSL::SSL::SSLSocket.new(raw, client_context).connect
|
37
37
|
end
|
38
38
|
peer = within_io_actor { subject.accept }
|
39
39
|
peer.should be_a Celluloid::IO::SSLSocket
|
@@ -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
|
-
|
51
|
+
Celluloid::IO.should_not be_evented
|
52
52
|
end
|
53
53
|
end
|
54
54
|
|
@@ -56,7 +56,7 @@ describe Celluloid::IO::SSLServer do
|
|
56
56
|
with_ssl_server do |subject|
|
57
57
|
thread = Thread.new do
|
58
58
|
raw = TCPSocket.new(example_addr, example_ssl_port)
|
59
|
-
|
59
|
+
OpenSSL::SSL::SSLSocket.new(raw, client_context).connect
|
60
60
|
end
|
61
61
|
peer = subject.accept
|
62
62
|
peer.should be_a Celluloid::IO::SSLSocket
|
@@ -64,34 +64,35 @@ describe Celluloid::IO::SSLSocket do
|
|
64
64
|
with_ssl_sockets do |ssl_client, ssl_peer|
|
65
65
|
within_io_actor do
|
66
66
|
ssl_peer << request
|
67
|
-
ssl_client.read(request.size).should
|
67
|
+
ssl_client.read(request.size).should eq(request)
|
68
68
|
|
69
69
|
ssl_client << response
|
70
|
-
ssl_peer.read(response.size).should
|
70
|
+
ssl_peer.read(response.size).should eq(response)
|
71
71
|
end
|
72
72
|
end
|
73
73
|
end
|
74
74
|
|
75
75
|
it "starts SSL on a connected TCP socket" do
|
76
|
+
pending "JRuby support" if defined?(JRUBY_VERSION)
|
76
77
|
with_raw_sockets do |client, peer|
|
77
78
|
within_io_actor do
|
78
79
|
peer << request
|
79
|
-
client.read(request.size).should
|
80
|
+
client.read(request.size).should eq(request)
|
80
81
|
|
81
82
|
client << response
|
82
|
-
peer.read(response.size).should
|
83
|
+
peer.read(response.size).should eq(response)
|
83
84
|
|
84
85
|
# now that we've written bytes, upgrade to SSL
|
85
86
|
client_thread = Thread.new { OpenSSL::SSL::SSLSocket.new(client).connect }
|
86
87
|
ssl_peer = Celluloid::IO::SSLSocket.new peer, server_context
|
87
|
-
ssl_peer.should
|
88
|
+
ssl_peer.should eq(ssl_peer.accept)
|
88
89
|
ssl_client = client_thread.value
|
89
90
|
|
90
91
|
ssl_peer << request
|
91
|
-
ssl_client.read(request.size).should
|
92
|
+
ssl_client.read(request.size).should eq(request)
|
92
93
|
|
93
94
|
ssl_client << response
|
94
|
-
ssl_peer.read(response.size).should
|
95
|
+
ssl_peer.read(response.size).should eq(response)
|
95
96
|
end
|
96
97
|
end
|
97
98
|
end
|
@@ -101,32 +102,33 @@ describe Celluloid::IO::SSLSocket do
|
|
101
102
|
it "connects to SSL servers over TCP" do
|
102
103
|
with_ssl_sockets do |ssl_client, ssl_peer|
|
103
104
|
ssl_peer << request
|
104
|
-
ssl_client.read(request.size).should
|
105
|
+
ssl_client.read(request.size).should eq(request)
|
105
106
|
|
106
107
|
ssl_client << response
|
107
|
-
ssl_peer.read(response.size).should
|
108
|
+
ssl_peer.read(response.size).should eq(response)
|
108
109
|
end
|
109
110
|
end
|
110
111
|
|
111
112
|
it "starts SSL on a connected TCP socket" do
|
113
|
+
pending "JRuby support" if defined?(JRUBY_VERSION)
|
112
114
|
with_raw_sockets do |client, peer|
|
113
115
|
peer << request
|
114
|
-
client.read(request.size).should
|
116
|
+
client.read(request.size).should eq(request)
|
115
117
|
|
116
118
|
client << response
|
117
|
-
peer.read(response.size).should
|
119
|
+
peer.read(response.size).should eq(response)
|
118
120
|
|
119
121
|
# now that we've written bytes, upgrade to SSL
|
120
122
|
client_thread = Thread.new { OpenSSL::SSL::SSLSocket.new(client).connect }
|
121
123
|
ssl_peer = Celluloid::IO::SSLSocket.new peer, server_context
|
122
|
-
ssl_peer.should
|
124
|
+
ssl_peer.should eq(ssl_peer.accept)
|
123
125
|
ssl_client = client_thread.value
|
124
126
|
|
125
127
|
ssl_peer << request
|
126
|
-
ssl_client.read(request.size).should
|
128
|
+
ssl_client.read(request.size).should eq(request)
|
127
129
|
|
128
130
|
ssl_client << response
|
129
|
-
ssl_peer.read(response.size).should
|
131
|
+
ssl_peer.read(response.size).should eq(response)
|
130
132
|
end
|
131
133
|
end
|
132
134
|
end
|
@@ -135,13 +137,13 @@ describe Celluloid::IO::SSLSocket do
|
|
135
137
|
# FIXME: seems bad? o_O
|
136
138
|
pending "wtf is wrong with this on JRuby" if defined? JRUBY_VERSION
|
137
139
|
with_ssl_sockets do |ssl_client|
|
138
|
-
ssl_client.cert.to_der.should
|
140
|
+
ssl_client.cert.to_der.should eq(client_cert.to_der)
|
139
141
|
end
|
140
142
|
end
|
141
143
|
|
142
144
|
it "knows its peer_cert" do
|
143
145
|
with_ssl_sockets do |ssl_client|
|
144
|
-
ssl_client.peer_cert.to_der.should
|
146
|
+
ssl_client.peer_cert.to_der.should eq(ssl_client.to_io.peer_cert.to_der)
|
145
147
|
end
|
146
148
|
end
|
147
149
|
|
@@ -155,7 +157,7 @@ describe Celluloid::IO::SSLSocket do
|
|
155
157
|
|
156
158
|
it "knows its cipher" do
|
157
159
|
with_ssl_sockets do |ssl_client|
|
158
|
-
ssl_client.cipher.should
|
160
|
+
ssl_client.cipher.should eq(ssl_client.to_io.cipher)
|
159
161
|
end
|
160
162
|
end
|
161
163
|
|
@@ -164,7 +166,7 @@ describe Celluloid::IO::SSLSocket do
|
|
164
166
|
pending "jruby-openssl support" if defined? JRUBY_VERSION
|
165
167
|
|
166
168
|
with_ssl_sockets do |ssl_client|
|
167
|
-
ssl_client.client_ca.should
|
169
|
+
ssl_client.client_ca.should eq(ssl_client.to_io.client_ca)
|
168
170
|
end
|
169
171
|
end
|
170
172
|
|
@@ -173,7 +175,7 @@ describe Celluloid::IO::SSLSocket do
|
|
173
175
|
pending "jruby-openssl support" if defined? JRUBY_VERSION
|
174
176
|
|
175
177
|
with_ssl_sockets do |ssl_client, ssl_peer|
|
176
|
-
ssl_client.verify_result.should
|
178
|
+
ssl_client.verify_result.should eq(OpenSSL::X509::V_ERR_DEPTH_ZERO_SELF_SIGNED_CERT)
|
177
179
|
end
|
178
180
|
end
|
179
181
|
|
@@ -7,7 +7,7 @@ describe Celluloid::IO::TCPServer do
|
|
7
7
|
context "inside Celluloid::IO" do
|
8
8
|
it "should be evented" do
|
9
9
|
with_tcp_server do |subject|
|
10
|
-
within_io_actor {
|
10
|
+
within_io_actor { Celluloid::IO.evented? }.should be_true
|
11
11
|
end
|
12
12
|
end
|
13
13
|
|
@@ -26,7 +26,7 @@ describe Celluloid::IO::TCPServer do
|
|
26
26
|
context "outside Celluloid::IO" do
|
27
27
|
it "should be blocking" do
|
28
28
|
with_tcp_server do |subject|
|
29
|
-
|
29
|
+
Celluloid::IO.should_not be_evented
|
30
30
|
end
|
31
31
|
end
|
32
32
|
|
@@ -20,7 +20,7 @@ describe Celluloid::IO::TCPSocket do
|
|
20
20
|
|
21
21
|
it "should be evented" do
|
22
22
|
with_connected_sockets do |subject|
|
23
|
-
within_io_actor {
|
23
|
+
within_io_actor { Celluloid::IO.evented? }.should be_true
|
24
24
|
end
|
25
25
|
end
|
26
26
|
|
@@ -108,6 +108,7 @@ describe Celluloid::IO::TCPSocket do
|
|
108
108
|
end
|
109
109
|
|
110
110
|
it "raises IOError when partial reading from a socket the peer closed" do
|
111
|
+
pending "async block running on receiver"
|
111
112
|
with_connected_sockets do |subject, peer|
|
112
113
|
actor = ExampleActor.new
|
113
114
|
begin
|
@@ -140,7 +141,7 @@ describe Celluloid::IO::TCPSocket do
|
|
140
141
|
|
141
142
|
it "should be blocking" do
|
142
143
|
with_connected_sockets do |subject|
|
143
|
-
|
144
|
+
Celluloid::IO.should_not be_evented
|
144
145
|
end
|
145
146
|
end
|
146
147
|
|
@@ -12,18 +12,20 @@ describe Celluloid::IO::UDPSocket do
|
|
12
12
|
|
13
13
|
context "inside Celluloid::IO" do
|
14
14
|
it "should be evented" do
|
15
|
-
within_io_actor {
|
15
|
+
within_io_actor { Celluloid::IO.evented? }.should be_true
|
16
16
|
end
|
17
17
|
|
18
18
|
it "sends and receives packets" do
|
19
|
-
|
20
|
-
|
19
|
+
within_io_actor do
|
20
|
+
subject.send payload, 0, example_addr, example_port
|
21
|
+
subject.recvfrom(payload.size).first.should == payload
|
22
|
+
end
|
21
23
|
end
|
22
24
|
end
|
23
25
|
|
24
26
|
context "outside Celluloid::IO" do
|
25
27
|
it "should be blocking" do
|
26
|
-
|
28
|
+
Celluloid::IO.should_not be_evented
|
27
29
|
end
|
28
30
|
|
29
31
|
it "sends and receives packets" do
|
@@ -11,7 +11,7 @@ describe Celluloid::IO::UNIXServer do
|
|
11
11
|
context "inside Celluloid::IO" do
|
12
12
|
it "should be evented" do
|
13
13
|
with_unix_server do |subject|
|
14
|
-
within_io_actor {
|
14
|
+
within_io_actor { Celluloid::IO.evented? }.should be_true
|
15
15
|
end
|
16
16
|
end
|
17
17
|
|
@@ -40,7 +40,7 @@ describe Celluloid::IO::UNIXServer do
|
|
40
40
|
context "outside Celluloid::IO" do
|
41
41
|
it "should be blocking" do
|
42
42
|
with_unix_server do |subject|
|
43
|
-
|
43
|
+
Celluloid::IO.should_not be_evented
|
44
44
|
end
|
45
45
|
end
|
46
46
|
|
@@ -25,7 +25,7 @@ describe Celluloid::IO::UNIXSocket do
|
|
25
25
|
|
26
26
|
it "should be evented" do
|
27
27
|
with_connected_unix_sockets do |subject|
|
28
|
-
within_io_actor {
|
28
|
+
within_io_actor { Celluloid::IO.evented? }.should be_true
|
29
29
|
end
|
30
30
|
end
|
31
31
|
|
@@ -112,7 +112,7 @@ describe Celluloid::IO::UNIXSocket do
|
|
112
112
|
|
113
113
|
it "should be blocking" do
|
114
114
|
with_connected_unix_sockets do |subject|
|
115
|
-
|
115
|
+
Celluloid::IO.should_not be_evented
|
116
116
|
end
|
117
117
|
end
|
118
118
|
|
data/spec/spec_helper.rb
CHANGED
@@ -8,15 +8,25 @@ Coveralls.wear!
|
|
8
8
|
logfile = File.open(File.expand_path("../../log/test.log", __FILE__), 'a')
|
9
9
|
Celluloid.logger = Logger.new(logfile)
|
10
10
|
|
11
|
+
RSpec.configure do |config|
|
12
|
+
config.before do
|
13
|
+
Celluloid.shutdown
|
14
|
+
Celluloid.boot
|
15
|
+
FileUtils.rm("/tmp/cell_sock") if File.exist?("/tmp/cell_sock")
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
11
19
|
# FIXME: Hax until test termination can be cleaned up
|
12
20
|
module Celluloid
|
13
21
|
class << self
|
22
|
+
undef :shutdown
|
14
23
|
def shutdown; end # hax: noop!
|
15
24
|
end
|
16
25
|
end
|
17
26
|
|
18
27
|
class ExampleActor
|
19
28
|
include Celluloid::IO
|
29
|
+
execute_block_on_receiver :wrap
|
20
30
|
|
21
31
|
def wrap
|
22
32
|
yield
|
metadata
CHANGED
@@ -1,116 +1,102 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: celluloid-io
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
5
|
-
prerelease:
|
4
|
+
version: 0.14.0.pre
|
6
5
|
platform: ruby
|
7
6
|
authors:
|
8
7
|
- Tony Arcieri
|
9
8
|
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date: 2013-
|
11
|
+
date: 2013-05-01 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: celluloid
|
16
15
|
requirement: !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
16
|
requirements:
|
19
|
-
- -
|
17
|
+
- - '>='
|
20
18
|
- !ruby/object:Gem::Version
|
21
19
|
version: 0.13.0
|
22
20
|
type: :runtime
|
23
21
|
prerelease: false
|
24
22
|
version_requirements: !ruby/object:Gem::Requirement
|
25
|
-
none: false
|
26
23
|
requirements:
|
27
|
-
- -
|
24
|
+
- - '>='
|
28
25
|
- !ruby/object:Gem::Version
|
29
26
|
version: 0.13.0
|
30
27
|
- !ruby/object:Gem::Dependency
|
31
28
|
name: nio4r
|
32
29
|
requirement: !ruby/object:Gem::Requirement
|
33
|
-
none: false
|
34
30
|
requirements:
|
35
|
-
- -
|
31
|
+
- - '>='
|
36
32
|
- !ruby/object:Gem::Version
|
37
33
|
version: 0.4.0
|
38
34
|
type: :runtime
|
39
35
|
prerelease: false
|
40
36
|
version_requirements: !ruby/object:Gem::Requirement
|
41
|
-
none: false
|
42
37
|
requirements:
|
43
|
-
- -
|
38
|
+
- - '>='
|
44
39
|
- !ruby/object:Gem::Version
|
45
40
|
version: 0.4.0
|
46
41
|
- !ruby/object:Gem::Dependency
|
47
42
|
name: rake
|
48
43
|
requirement: !ruby/object:Gem::Requirement
|
49
|
-
none: false
|
50
44
|
requirements:
|
51
|
-
- -
|
45
|
+
- - '>='
|
52
46
|
- !ruby/object:Gem::Version
|
53
47
|
version: '0'
|
54
48
|
type: :development
|
55
49
|
prerelease: false
|
56
50
|
version_requirements: !ruby/object:Gem::Requirement
|
57
|
-
none: false
|
58
51
|
requirements:
|
59
|
-
- -
|
52
|
+
- - '>='
|
60
53
|
- !ruby/object:Gem::Version
|
61
54
|
version: '0'
|
62
55
|
- !ruby/object:Gem::Dependency
|
63
56
|
name: rspec
|
64
57
|
requirement: !ruby/object:Gem::Requirement
|
65
|
-
none: false
|
66
58
|
requirements:
|
67
|
-
- -
|
59
|
+
- - '>='
|
68
60
|
- !ruby/object:Gem::Version
|
69
61
|
version: '0'
|
70
62
|
type: :development
|
71
63
|
prerelease: false
|
72
64
|
version_requirements: !ruby/object:Gem::Requirement
|
73
|
-
none: false
|
74
65
|
requirements:
|
75
|
-
- -
|
66
|
+
- - '>='
|
76
67
|
- !ruby/object:Gem::Version
|
77
68
|
version: '0'
|
78
69
|
- !ruby/object:Gem::Dependency
|
79
70
|
name: benchmark_suite
|
80
71
|
requirement: !ruby/object:Gem::Requirement
|
81
|
-
none: false
|
82
72
|
requirements:
|
83
|
-
- -
|
73
|
+
- - '>='
|
84
74
|
- !ruby/object:Gem::Version
|
85
75
|
version: '0'
|
86
76
|
type: :development
|
87
77
|
prerelease: false
|
88
78
|
version_requirements: !ruby/object:Gem::Requirement
|
89
|
-
none: false
|
90
79
|
requirements:
|
91
|
-
- -
|
80
|
+
- - '>='
|
92
81
|
- !ruby/object:Gem::Version
|
93
82
|
version: '0'
|
94
83
|
- !ruby/object:Gem::Dependency
|
95
84
|
name: guard-rspec
|
96
85
|
requirement: !ruby/object:Gem::Requirement
|
97
|
-
none: false
|
98
86
|
requirements:
|
99
|
-
- -
|
87
|
+
- - '>='
|
100
88
|
- !ruby/object:Gem::Version
|
101
89
|
version: '0'
|
102
90
|
type: :development
|
103
91
|
prerelease: false
|
104
92
|
version_requirements: !ruby/object:Gem::Requirement
|
105
|
-
none: false
|
106
93
|
requirements:
|
107
|
-
- -
|
94
|
+
- - '>='
|
108
95
|
- !ruby/object:Gem::Version
|
109
96
|
version: '0'
|
110
97
|
- !ruby/object:Gem::Dependency
|
111
98
|
name: rb-fsevent
|
112
99
|
requirement: !ruby/object:Gem::Requirement
|
113
|
-
none: false
|
114
100
|
requirements:
|
115
101
|
- - ~>
|
116
102
|
- !ruby/object:Gem::Version
|
@@ -118,7 +104,6 @@ dependencies:
|
|
118
104
|
type: :development
|
119
105
|
prerelease: false
|
120
106
|
version_requirements: !ruby/object:Gem::Requirement
|
121
|
-
none: false
|
122
107
|
requirements:
|
123
108
|
- - ~>
|
124
109
|
- !ruby/object:Gem::Version
|
@@ -180,27 +165,26 @@ files:
|
|
180
165
|
- tasks/rspec.task
|
181
166
|
homepage: http://github.com/celluloid/celluloid-io
|
182
167
|
licenses: []
|
168
|
+
metadata: {}
|
183
169
|
post_install_message:
|
184
170
|
rdoc_options: []
|
185
171
|
require_paths:
|
186
172
|
- lib
|
187
173
|
required_ruby_version: !ruby/object:Gem::Requirement
|
188
|
-
none: false
|
189
174
|
requirements:
|
190
|
-
- -
|
175
|
+
- - '>='
|
191
176
|
- !ruby/object:Gem::Version
|
192
177
|
version: '0'
|
193
178
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
194
|
-
none: false
|
195
179
|
requirements:
|
196
|
-
- -
|
180
|
+
- - '>'
|
197
181
|
- !ruby/object:Gem::Version
|
198
|
-
version:
|
182
|
+
version: 1.3.1
|
199
183
|
requirements: []
|
200
184
|
rubyforge_project:
|
201
|
-
rubygems_version:
|
185
|
+
rubygems_version: 2.0.3
|
202
186
|
signing_key:
|
203
|
-
specification_version:
|
187
|
+
specification_version: 4
|
204
188
|
summary: Celluloid::IO allows you to monitor multiple IO objects within a Celluloid
|
205
189
|
actor
|
206
190
|
test_files:
|
@@ -219,4 +203,3 @@ test_files:
|
|
219
203
|
- spec/fixtures/server.crt
|
220
204
|
- spec/fixtures/server.key
|
221
205
|
- spec/spec_helper.rb
|
222
|
-
has_rdoc:
|