module Roma::Client::Proxy::ClientHandler

Public Instance Methods

get_roma_handler(cmd_line) click to toggle source
   # File lib/roma/client/proxy/daemon.rb
63 def get_roma_handler(cmd_line)
64   cmd, key_hname = cmd_line.split(' ')
65   key, hname = key_hname.split("\e")
66   nid, d = Daemon::rttable.search_node(key)
67   Conpool::instance.get_connection(nid, RomaHandler)
68 rescue =>e
69   $log.error("#{e} #{$@}")
70 end
post_init() click to toggle source
   # File lib/roma/client/proxy/daemon.rb
34 def post_init
35   $log.info("Connected from client")
36   @cmd = ''
37 end
receive_data(data) click to toggle source
   # File lib/roma/client/proxy/daemon.rb
39 def receive_data(data)
40   @cmd << data
41   if @cmd.index("\n")
42     @roma_h = get_roma_handler(@cmd)
43     @roma_h.send_data(@cmd)
44     @cmd = ''
45     EM::enable_proxy(self, @roma_h)
46     EM::enable_proxy(@roma_h, self)
47   end
48 rescue =>e
49   $log.error("#{e} #{$@}")
50 end
unbind() click to toggle source
   # File lib/roma/client/proxy/daemon.rb
52 def unbind
53   $log.info("Disconnected from client")
54   EM::disable_proxy(self)
55   if @roma_h
56     EM::disable_proxy(@roma_h)
57     Conpool::instance.return_connection(@roma_h)
58   end
59 rescue =>e
60   $log.error("#{e} #{$@}")
61 end