class Api2cart::Daemon::ProxyServer
Public Instance Methods
run(port)
click to toggle source
# File lib/api2cart/daemon/proxy_server.rb, line 7 def run(port) accept_connections bind_proxy_socket(port) end
run_async(port)
click to toggle source
# File lib/api2cart/daemon/proxy_server.rb, line 11 def run_async(port) async.accept_connections bind_proxy_socket(port) end
Protected Instance Methods
accept_connections(proxy_socket)
click to toggle source
# File lib/api2cart/daemon/proxy_server.rb, line 23 def accept_connections(proxy_socket) loop { async.handle_connection proxy_socket.accept } end
bind_proxy_socket(port)
click to toggle source
# File lib/api2cart/daemon/proxy_server.rb, line 17 def bind_proxy_socket(port) TCPServer.new('', port).tap do puts "API2Cart Daemon is running at 0.0.0.0:#{port}" end end
handle_connection(client_socket)
click to toggle source
# File lib/api2cart/daemon/proxy_server.rb, line 27 def handle_connection(client_socket) begin ProxyConnectionHandler.new.handle_proxy_connection(client_socket) rescue Exception => e puts "! Exception: #{e.inspect}" end end