lib/dcell/celluloid_ext.rb in dcell-0.12.0.pre vs lib/dcell/celluloid_ext.rb in dcell-0.13.0.pre
- old
+ new
@@ -12,14 +12,14 @@
class ActorProxy
# Marshal uses respond_to? to determine if this object supports _dump so
# unfortunately we have to monkeypatch in _dump support as the proxy
# itself normally jacks respond_to? and proxies to the actor
alias_method :__respond_to?, :respond_to?
- def respond_to?(meth)
+ def respond_to?(meth, check_private = false)
return false if meth == :marshal_dump
return true if meth == :_dump
- __respond_to? meth
+ __respond_to?(meth, check_private)
end
# Dump an actor proxy via its mailbox
def _dump(level)
@mailbox._dump(level)
@@ -41,23 +41,27 @@
end
end
def self.find_actor(mailbox)
::Thread.list.each do |t|
- if actor = t[:actor]
+ if actor = t[:celluloid_actor]
return actor if actor.mailbox == mailbox
end
end
::Kernel.raise "no actor found for mailbox: #{mailbox.inspect}"
end
end
class Mailbox
+ def address
+ "#{@address}@#{DCell.id}"
+ end
+
# This custom dumper registers actors with the DCell registry so they can
# be reached remotely.
def _dump(level)
- mailbox_id = DCell::Router.register self
- "#{mailbox_id}@#{DCell.id}"
+ DCell::Router.register self
+ address
end
# Create a mailbox proxy object which routes messages over DCell's overlay
# network and back to the original mailbox
def self._load(string)