def add(peer)
      raise "Peer must have it's infoHash set." if ! peer.infoHash

      # Do not add if peer is already present by address
      if @peersByAddr.has_key?(byAddrKey(peer))
        @log.debug "Not adding peer #{peer} since it already exists by #{@peersById.has_key?(peer.trackerPeer.id) ? "id" : "addr"}."
        return
      end

      if peer.trackerPeer.id
        @peersById.pushToList(peer.trackerPeer.id, peer)
        
        # If id is null, this is probably a peer received from the tracker that has no ID.
      end

      @peersByAddr[byAddrKey(peer)] = peer

      @peersByInfoHash.pushToList(peer.infoHash, peer)
    end
def add(peer)
      raise "Peer must have it's infoHash set." if ! peer.infoHash

      # Do not add if peer is already present by address
      if @peersByAddr.has_key?(byAddrKey(peer))
        @log.debug "Not adding peer #{peer} since it already exists by #{@peersById.has_key?(peer.trackerPeer.id) ? "id" : "addr"}."
        return
      end

      if peer.trackerPeer.id
        @peersById.pushToList(peer.trackerPeer.id, peer)
        
        # If id is null, this is probably a peer received from the tracker that has no ID.
      end

      @peersByAddr[byAddrKey(peer)] = peer

      @peersByInfoHash.pushToList(peer.infoHash, peer)
    end
Add a peer to the PeerHolder.