Examples of neighborsSet()


Examples of net.tomp2p.message.Message.neighborsSet()

    Collection<PeerAddress> neighbors = getNeighbors(locationKey, NeighborRPC.NEIGHBOR_SIZE);
    if (neighbors == null) {
      // return empty neighbor set
      Message response = createResponseMessage(message, Type.NOT_FOUND, unreachablePeer);
      response.neighborsSet(new NeighborSet(-1, Collections.<PeerAddress> emptyList()));
      responder.response(response);
      return;
    }

    // Create response message and set neighbors
View Full Code Here

Examples of net.tomp2p.message.Message.neighborsSet()

    // neighbors.add(peerConnection.remotePeer());

    LOG.debug("found the following neighbors {}", neighbors);

    NeighborSet neighborSet = new NeighborSet(NeighborRPC.NEIGHBOR_LIMIT, neighbors);
    responseMessage.neighborsSet(neighborSet);

    // we can't do fast get here, as we only send over the neighbors and not the keys stored
    responder.response(responseMessage);
  }
View Full Code Here

Examples of net.tomp2p.message.Message.neighborsSet()

    LOG.debug("Sending current routing table to relay {}", connection.relayAddress());

    final Message message = relayRPC
        .createMessage(connection.relayAddress(), RPC.Commands.RELAY.getNr(), Type.REQUEST_3);
    // TODO: neighbor size limit is 256, we might have more here
    message.neighborsSet(new NeighborSet(-1, RelayUtils.flatten(map)));

    final FutureResponse fr = connection.sendToRelay(message);
    fr.addListener(new BaseFutureAdapter<BaseFuture>() {
      public void operationComplete(BaseFuture future) throws Exception {
        if (future.isFailed()) {
View Full Code Here

Examples of net.tomp2p.message.Message.neighborsSet()

    Message forwardMessage = createMessage(recipient, RPC.Commands.RCON.getNr(), Message.Type.REQUEST_2);

    // transmit PeerAddress of reachablePeer
    final NeighborSet ns = new NeighborSet(1, new ArrayList<PeerAddress>(1));
    ns.add(message.sender());
    forwardMessage.neighborsSet(ns);

    if (!message.intList().isEmpty()) {
      // store the message id for new message to identify the cached message afterwards
      forwardMessage.intValue(message.intAt(0));
    }
View Full Code Here

Examples of net.tomp2p.message.Message.neighborsSet()

                final boolean finished;
                if (future.isSuccess()) {
                    Message lastResponse = future.last().responseMessage();
                    PeerAddress remotePeer = lastResponse.sender();
                    routingMechanism.addPotentialHits(remotePeer);
                    Collection<PeerAddress> newNeighbors = lastResponse.neighborsSet(0).neighbors();

                    Integer resultSize = lastResponse.intAt(0);
                    Number160 keyDigest = lastResponse.key(0);
                    Number160 contentDigest = lastResponse.key(1);
                    DigestInfo digestBean = new DigestInfo(keyDigest, contentDigest, resultSize == null ? 0
View Full Code Here

Examples of net.tomp2p.message.Message.neighborsSet()

     *            The destination peer
     * @return The future of this discover handler
     */
    private FutureResponse createDiscoverHandler(final PeerAddress remotePeer) {
        final Message message = createMessage(remotePeer, RPC.Commands.PING.getNr(), Type.REQUEST_2);
        message.neighborsSet(createNeighborSet(peerBean().serverPeerAddress()));
        return new FutureResponse(message);
    }

    /**
     * Create a neighbor set with one peer. We only support sending a neighbor set, so we need this wrapper class.
View Full Code Here

Examples of net.tomp2p.message.Message.neighborsSet()

                        });
            }
        } else if (message.type() == Type.REQUEST_2) { // discover
            LOG.debug("reply to discover, found {}", message.sender());
            responseMessage = createResponseMessage(message, Type.OK);
            responseMessage.neighborsSet(createNeighborSet(message.sender()));
        } else if (message.type() == Type.REQUEST_1 || message.type() == Type.REQUEST_4) { // regular ping
            LOG.debug("reply to regular ping {}", message.sender());
            // test if this is a broadcast message to ourselves. If it is, do not
            // reply.
            if (message.isUdp() && message.sender().peerId().equals(peerBean().serverPeerAddress().peerId())
View Full Code Here

Examples of net.tomp2p.message.Message.neighborsSet()

      @Override
            public void operationComplete(FutureResponse future) throws Exception {
              if(future.isSuccess()) {
                Message response = future.responseMessage();
                if(response != null) {
                  NeighborSet ns = response.neighborsSet(0);
                  if(ns!=null) {
                    for(PeerAddress neighbors:ns.neighbors()) {
                      synchronized (peerBean().peerStatusListeners()) {
                        for (PeerStatusListener peerStatusListener : peerBean().peerStatusListeners()) {
                          peerStatusListener.peerFound(neighbors, response.sender(), null);
View Full Code Here

Examples of net.tomp2p.message.Message.neighborsSet()

       
        Collection<PeerAddress> neighbors = getNeighbors(locationKey, NEIGHBOR_SIZE);
        if(neighbors == null) {
            //return empty neighbor set
            Message response = createResponseMessage(message, Type.NOT_FOUND);
            response.neighborsSet(new NeighborSet(-1, Collections.<PeerAddress>emptyList()));
            responder.response(response);
            return;
        }
       
        // Create response message and set neighbors
View Full Code Here

Examples of net.tomp2p.message.Message.neighborsSet()

        // Create response message and set neighbors
        final Message responseMessage = createResponseMessage(message, Type.OK);
       
        LOG.debug("found the following neighbors {}", neighbors);
        NeighborSet neighborSet = new NeighborSet(NEIGHBOR_LIMIT, neighbors);
        responseMessage.neighborsSet(neighborSet);
        // check for fastget, -1 if, no domain provided, so we cannot
        // check content length, 0 for content not here , > 0 content here
        // int contentLength = -1;
        Number160 contentKey = message.key(2);
        SimpleBloomFilter<Number160> keyBloomFilter = message.bloomFilter(0);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.