class Pione::DRbPatch::RequestLooper

RequestLooper is a receiver of client request. This is different from standard DRb’s main_loop at the point that this method doesn’t need to wait finishing evaluation of request and reply.

Public Class Methods

new(server) click to toggle source
# File lib/pione/patch/drb-patch.rb, line 441
def initialize(server)
  @server = server
end

Public Instance Methods

start(client) click to toggle source
# File lib/pione/patch/drb-patch.rb, line 445
def start(client)
  loop {handle_client_request(client)}
end

Private Instance Methods

handle_client_request(client) click to toggle source
# File lib/pione/patch/drb-patch.rb, line 451
def handle_client_request(client)
  # take request from client
  request = ClientRequest.receive(client)

  # run invoker
  invoker = RequestInvoker.new(@server, client, request)
  @server.invoker_threads.add(Thread.new{invoker.invoke})
rescue DRb::DRbConnError => e
  Log::Debug.communication("server was disconnected from client because of connection error")
  client.close
  raise StopIteration
end