Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use Rubinius namespace for actor lib, so it works with rubinius-actor gem. #1

Merged
merged 1 commit into from Jun 20, 2011
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
16 changes: 8 additions & 8 deletions lib/noise/connection.rb
@@ -1,4 +1,4 @@
require "actor"
require "rubinius/actor"
require "socket"
require "fcntl"
require "stringio"
Expand All @@ -12,14 +12,14 @@ class Noise::Connection

class << self
def supervisor
Actor.spawn do
Rubinius::Actor.spawn do
supervisor = Actor.current

loop do
Actor.receive do |request|
Rubinius::Actor.receive do |request|
request.when @@new do |req|
child = Actor.spawn_link(&req.instance.connection)
Actor.register(req.instance.object_id.to_s.to_sym, child)
child = Rubinius::Actor.spawn_link(&req.instance.connection)
Rubinius::Actor.register(req.instance.object_id.to_s.to_sym, child)
end

end
Expand All @@ -43,7 +43,7 @@ def initialize args
end

def actor
@actor ||= Actor.lookup(self.object_id.to_s.to_sym)
@actor ||= Rubinius::Actor.lookup(self.object_id.to_s.to_sym)
end

def write frame
Expand Down Expand Up @@ -102,7 +102,7 @@ def connection
buffer = StringIO.new

loop do
Actor.receive do |request|
Rubinius::Actor.receive do |request|
request.when @@full do
@callback.call(buffer.string)
buffer = StringIO.new
Expand All @@ -114,7 +114,7 @@ def connection

request.when @@byte do |byte|
if byte[:packet] === Noise::Frame.zero
Actor.current << @@full[0]
Rubinius::Actor.current << @@full[0]
else
buffer << byte[:packet]
end
Expand Down