Package net.tomp2p.message

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


    rconMessage.version(message.version());
    // store the message id in the payload to get the cached message later
    rconMessage.intValue(message.messageId());
    // the message must have set the keepAlive Flag true. If not, the relay
    // peer will close the PeerConnection to the unreachable peer.
    rconMessage.keepAlive(true);
    // making the message ready to send
    PeerAddress recipient = message.recipient().changeAddress(socketAddress.inetAddress())
            .changePorts(socketAddress.tcpPort(), socketAddress.udpPort()).changeRelayed(false);
    rconMessage.recipient(recipient);
    rconMessage.command(RPC.Commands.RCON.getNr());
View Full Code Here


      // forward the message id to indentify the cached message afterwards
      readyForRequestMessage.intValue(message.intAt(0));
    }

    // keep the new connection open
    readyForRequestMessage.keepAlive(true);

    return readyForRequestMessage;
  }

  /**
 
View Full Code Here

    final FutureDone<PeerConnection> futureDone = new FutureDone<PeerConnection>();

    final Message message = relayRPC.createMessage(candidate, RPC.Commands.RELAY.getNr(), Type.REQUEST_1);

    // depend on the relay type whether to keep the connection open or close it after the setup.
    message.keepAlive(relayType.keepConnectionOpen());

    // encode the relay type in the message such that the relay node knows how to handle
    message.intValue(relayType.ordinal());

    // server credentials only used by Android peers
View Full Code Here

      LOG.error("Cannot encode the message", e);
      return new FutureDone<Message>().failed(e);
    }

    // always keep the connection open
    envelope.keepAlive(true);

    // this will be read RelayRPC.handlePiggyBackMessage
    Collection<PeerSocketAddress> peerSocketAddresses = new ArrayList<PeerSocketAddress>(1);
    peerSocketAddresses.add(new PeerSocketAddress(message.sender().inetAddress(), 0, 0));
    envelope.peerSocketAddresses(peerSocketAddresses);
View Full Code Here

  public FutureDone<Void> sendBufferRequest() {
    final FutureDone<Void> futureDone = new FutureDone<Void>();

    Message message = dispatchHandler.createMessage(relayAddress(), Commands.RELAY.getNr(), Type.REQUEST_4);
    // close the connection after this message
    message.keepAlive(false);

    FutureResponse response = sendToRelay(message);
    response.addListener(new BaseFutureAdapter<FutureResponse>() {
      @Override
      public void operationComplete(FutureResponse futureResponse) throws Exception {
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.