Skip to content

Commit

Permalink
Use Rubinius namespace for actor lib, so it works with rubinius-actor…
Browse files Browse the repository at this point in the history
… gem.
  • Loading branch information
headius committed Jun 20, 2011
1 parent ef16ae3 commit 9e6af7e
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions lib/noise/connection.rb
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit 9e6af7e

Please sign in to comment.