class Plug::PeerList

Public Class Methods

new(owner, *args) click to toggle source
Calls superclass method
# File lib/rbkb/plug/peer.rb, line 44
def initialize(owner, *args)
  @owner = owner
  @transport = @owner.transport
  
  super(*args)
end

Public Instance Methods

add_peer(addr) click to toggle source
# File lib/rbkb/plug/peer.rb, line 55
def add_peer(addr)
  self << Peer.new(addr, @owner)
  self.last
end
add_peer_manually(host, port) click to toggle source
# File lib/rbkb/plug/peer.rb, line 60
def add_peer_manually(host, port)
  addr = Socket.pack_sockaddr_in(port, host)
  return (find_peer(addr) || add_peer(addr))
end
delete(addr) click to toggle source
Calls superclass method
# File lib/rbkb/plug/peer.rb, line 65
def delete(addr)
  if p=find_peer(addr)
    p.close
    super(p)
  end
end
find_peer(addr) click to toggle source
# File lib/rbkb/plug/peer.rb, line 51
def find_peer(addr)
  self.find {|p| p.addr == addr }
end