class FFWD::Debug::Connection

Public Class Methods

new(handler) click to toggle source
# File lib/ffwd/debug/connection.rb, line 20
def initialize handler
  @handler = handler
  @peer = nil
  @ip = nil
  @port = nil
end

Public Instance Methods

get_peer() click to toggle source
# File lib/ffwd/debug/connection.rb, line 27
def get_peer
  peer = get_peername
  port, ip = Socket.unpack_sockaddr_in(peer)
  return peer, ip, port
end
post_init() click to toggle source
# File lib/ffwd/debug/connection.rb, line 33
def post_init
  @peer, @ip, @port = get_peer
  @handler.register_client @peer, self
  log.info "#{@ip}:#{@port}: Connect"
end
send_line(line) click to toggle source
# File lib/ffwd/debug/connection.rb, line 44
def send_line line
  send_data "#{line}\n"
end
unbind() click to toggle source
# File lib/ffwd/debug/connection.rb, line 39
def unbind
  @handler.unregister_client @peer, self
  log.info "#{@ip}:#{@port}: Disconnect"
end