celluloid-io 0.11.0 → 0.12.0
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGES.md +4 -0
- data/Gemfile +1 -1
- data/celluloid-io.gemspec +1 -1
- data/examples/echo_client.rb +2 -2
- data/lib/celluloid/io/common_methods.rb +3 -2
- data/lib/celluloid/io/dns_resolver.rb +2 -1
- data/lib/celluloid/io/mailbox.rb +12 -16
- data/lib/celluloid/io/version.rb +1 -1
- metadata +34 -33
data/CHANGES.md
CHANGED
data/Gemfile
CHANGED
data/celluloid-io.gemspec
CHANGED
@@ -15,7 +15,7 @@ Gem::Specification.new do |gem|
|
|
15
15
|
gem.require_paths = ["lib"]
|
16
16
|
gem.version = Celluloid::IO::VERSION
|
17
17
|
|
18
|
-
gem.add_dependency 'celluloid', '~> 0.
|
18
|
+
gem.add_dependency 'celluloid', '~> 0.12.0'
|
19
19
|
gem.add_dependency 'nio4r', '>= 0.4.0'
|
20
20
|
|
21
21
|
gem.add_development_dependency 'rake'
|
data/examples/echo_client.rb
CHANGED
@@ -10,12 +10,12 @@ class EchoClient
|
|
10
10
|
def initialize(host, port)
|
11
11
|
puts "*** Connecting to echo server on #{host}:#{port}"
|
12
12
|
|
13
|
-
|
13
|
+
# This is actually creating a Celluloid::IO::TCPSocket
|
14
|
+
@socket = TCPSocket.new(host, port)
|
14
15
|
end
|
15
16
|
|
16
17
|
def echo(s)
|
17
18
|
@socket.write(s)
|
18
|
-
actor = Celluloid.current_actor
|
19
19
|
@socket.readpartial(4096)
|
20
20
|
end
|
21
21
|
|
@@ -39,7 +39,8 @@ module Celluloid
|
|
39
39
|
else raise ArgumentError, "invalid ownership type: #{type}"
|
40
40
|
end
|
41
41
|
|
42
|
-
|
42
|
+
# Celluloid needs a better API here o_O
|
43
|
+
Thread.current[:actor].wait(self) while instance_variable_get(ivar)
|
43
44
|
instance_variable_set(ivar, Task.current)
|
44
45
|
end
|
45
46
|
|
@@ -58,7 +59,7 @@ module Celluloid
|
|
58
59
|
|
59
60
|
raise "not owner" unless instance_variable_get(ivar) == Task.current
|
60
61
|
instance_variable_set(ivar, nil)
|
61
|
-
|
62
|
+
Thread.current[:actor].signal(self)
|
62
63
|
end
|
63
64
|
|
64
65
|
def read(length = nil, buffer = nil)
|
data/lib/celluloid/io/mailbox.rb
CHANGED
@@ -14,26 +14,22 @@ module Celluloid
|
|
14
14
|
def <<(message)
|
15
15
|
@mutex.lock
|
16
16
|
begin
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
rescue IOError
|
21
|
-
raise MailboxError, "dead recipient"
|
22
|
-
ensure
|
23
|
-
@mutex.unlock rescue nil
|
24
|
-
end
|
25
|
-
nil
|
26
|
-
end
|
17
|
+
if message.is_a?(SystemEvent)
|
18
|
+
# Silently swallow system events sent to dead actors
|
19
|
+
return if @dead
|
27
20
|
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
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
|
+
|
33
29
|
current_actor = Thread.current[:actor]
|
34
30
|
@reactor.wakeup unless current_actor && current_actor.mailbox == self
|
35
31
|
rescue IOError
|
36
|
-
|
32
|
+
raise MailboxError, "dead recipient"
|
37
33
|
ensure
|
38
34
|
@mutex.unlock rescue nil
|
39
35
|
end
|
data/lib/celluloid/io/version.rb
CHANGED
metadata
CHANGED
@@ -1,71 +1,71 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: celluloid-io
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
|
4
|
+
version: 0.12.0
|
5
|
+
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Tony Arcieri
|
9
|
-
autorequire:
|
9
|
+
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-09-04 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: celluloid
|
16
|
-
|
16
|
+
requirement: &70112015206080 !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
17
18
|
requirements:
|
18
19
|
- - ~>
|
19
20
|
- !ruby/object:Gem::Version
|
20
|
-
version: 0.
|
21
|
-
none: false
|
22
|
-
requirement: *2056
|
23
|
-
prerelease: false
|
21
|
+
version: 0.12.0
|
24
22
|
type: :runtime
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: *70112015206080
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: nio4r
|
27
|
-
|
27
|
+
requirement: &70112015221200 !ruby/object:Gem::Requirement
|
28
|
+
none: false
|
28
29
|
requirements:
|
29
30
|
- - ! '>='
|
30
31
|
- !ruby/object:Gem::Version
|
31
32
|
version: 0.4.0
|
32
|
-
none: false
|
33
|
-
requirement: *2074
|
34
|
-
prerelease: false
|
35
33
|
type: :runtime
|
34
|
+
prerelease: false
|
35
|
+
version_requirements: *70112015221200
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: rake
|
38
|
-
|
38
|
+
requirement: &70112015220460 !ruby/object:Gem::Requirement
|
39
|
+
none: false
|
39
40
|
requirements:
|
40
41
|
- - ! '>='
|
41
42
|
- !ruby/object:Gem::Version
|
42
43
|
version: '0'
|
43
|
-
none: false
|
44
|
-
requirement: *2090
|
45
|
-
prerelease: false
|
46
44
|
type: :development
|
45
|
+
prerelease: false
|
46
|
+
version_requirements: *70112015220460
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: rspec
|
49
|
-
|
49
|
+
requirement: &70112015219920 !ruby/object:Gem::Requirement
|
50
|
+
none: false
|
50
51
|
requirements:
|
51
52
|
- - ! '>='
|
52
53
|
- !ruby/object:Gem::Version
|
53
54
|
version: '0'
|
54
|
-
none: false
|
55
|
-
requirement: *2108
|
56
|
-
prerelease: false
|
57
55
|
type: :development
|
56
|
+
prerelease: false
|
57
|
+
version_requirements: *70112015219920
|
58
58
|
- !ruby/object:Gem::Dependency
|
59
59
|
name: benchmark_suite
|
60
|
-
|
60
|
+
requirement: &70112015219060 !ruby/object:Gem::Requirement
|
61
|
+
none: false
|
61
62
|
requirements:
|
62
63
|
- - ! '>='
|
63
64
|
- !ruby/object:Gem::Version
|
64
65
|
version: '0'
|
65
|
-
none: false
|
66
|
-
requirement: *2124
|
67
|
-
prerelease: false
|
68
66
|
type: :development
|
67
|
+
prerelease: false
|
68
|
+
version_requirements: *70112015219060
|
69
69
|
description: Evented IO for Celluloid actors
|
70
70
|
email:
|
71
71
|
- tony.arcieri@gmail.com
|
@@ -106,28 +106,29 @@ files:
|
|
106
106
|
- tasks/rspec.task
|
107
107
|
homepage: http://github.com/celluloid/celluloid-io
|
108
108
|
licenses: []
|
109
|
-
post_install_message:
|
109
|
+
post_install_message:
|
110
110
|
rdoc_options: []
|
111
111
|
require_paths:
|
112
112
|
- lib
|
113
113
|
required_ruby_version: !ruby/object:Gem::Requirement
|
114
|
+
none: false
|
114
115
|
requirements:
|
115
116
|
- - ! '>='
|
116
117
|
- !ruby/object:Gem::Version
|
117
118
|
version: '0'
|
118
|
-
none: false
|
119
119
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
120
|
+
none: false
|
120
121
|
requirements:
|
121
122
|
- - ! '>='
|
122
123
|
- !ruby/object:Gem::Version
|
123
124
|
version: '0'
|
124
|
-
none: false
|
125
125
|
requirements: []
|
126
|
-
rubyforge_project:
|
127
|
-
rubygems_version: 1.8.
|
128
|
-
signing_key:
|
126
|
+
rubyforge_project:
|
127
|
+
rubygems_version: 1.8.10
|
128
|
+
signing_key:
|
129
129
|
specification_version: 3
|
130
|
-
summary: Celluloid::IO allows you to monitor multiple IO objects within a Celluloid
|
130
|
+
summary: Celluloid::IO allows you to monitor multiple IO objects within a Celluloid
|
131
|
+
actor
|
131
132
|
test_files:
|
132
133
|
- spec/celluloid/io/actor_spec.rb
|
133
134
|
- spec/celluloid/io/dns_resolver_spec.rb
|
@@ -136,4 +137,4 @@ test_files:
|
|
136
137
|
- spec/celluloid/io/tcp_socket_spec.rb
|
137
138
|
- spec/celluloid/io/udp_socket_spec.rb
|
138
139
|
- spec/spec_helper.rb
|
139
|
-
|
140
|
+
has_rdoc:
|