.bundle/ruby/2.0.0/gems/celluloid-0.15.2/lib/celluloid/actor.rb
# Perform a linking request with another actor
Perform a linking request with another actor
Perform a linking request with another actor
def linking_request(receiver, type)
      Celluloid.exclusive do
        start_time = Time.now
        receiver.mailbox << LinkingRequest.new(Actor.current, type)
        system_events = []
        loop do
          wait_interval = start_time + LINKING_TIMEOUT - Time.now
          message = @mailbox.receive(wait_interval) do |msg|
            msg.is_a?(LinkingResponse) &&
            msg.actor.mailbox.address == receiver.mailbox.address &&
            msg.type == type
          end
          case message
          when LinkingResponse
            system_events.each { |ev| handle_system_event(ev) }
            return
          when NilClass
            raise TimeoutError, "linking timeout of #{LINKING_TIMEOUT} seconds exceeded"
          when SystemEvent
            system_events << message
          else raise 'wtf'
          end
        end
      end
    end
def linking_request ( receiver , type ) Celluloid . exclusive do start_time = Time . now receiver . mailbox << LinkingRequest . new ( Actor . current , type ) system_events = [ ] loop do wait_interval = start_time + LINKING_TIMEOUT - Time . now message = @mailbox . receive ( wait_interval ) do | msg | msg . is_a? ( LinkingResponse ) && msg . actor . mailbox . address == receiver . mailbox . address && msg . type == type end case message when LinkingResponse system_events . each { | ev | handle_system_event ( ev ) } return when NilClass raise TimeoutError , "linking timeout of #{LINKING_TIMEOUT} seconds exceeded" when SystemEvent system_events << message else raise 'wtf' end end end end
Perform a linking request with another actor
Perform a linking request with another actor
# We're done! # Queue up pending system events to be processed after we've successfully linked
receiver
type