Package marauroa.common.net.message

Examples of marauroa.common.net.message.MessageC2STransferACK


          logger.debug("Processing Content Transfer Request");
          List<TransferContent> items = ((MessageS2CTransferREQ) msg).getContents();

          items = onTransferREQ(items);

          MessageC2STransferACK reply = new MessageC2STransferACK(null, items);
          netMan.addMessage(reply);

          break;
        }
View Full Code Here


   * @param message
   *            the transfer ACK message
   */
  @Override
  public void process(Message message) {
    MessageC2STransferACK msg = (MessageC2STransferACK) message;
    try {
      int clientid = msg.getClientID();

      PlayerEntry entry = playerContainer.get(clientid);

      // verify event
      if (!isValidEvent(msg, entry, ClientState.GAME_BEGIN)) {
        return;
      }

      /*
       * Handle Transfer ACK here. We iterate over the contents and send
       * them to client for those of them which client told us ACK.
       */
      for (TransferContent content : msg.getContents()) {
        TransferContent contentToTransfer = entry.getContent(content.name);
        if (content.ack == true) {
          logger.debug("Trying transfer content " + content);

          /*
           * We get the content from those of that this client are
           * waiting for being sent to it.
           */
          if (contentToTransfer != null) {
            stats.add("Transfer content", 1);
            stats.add("Tranfer content size", contentToTransfer.data.length);

            logger.debug("Transfering content " + contentToTransfer);

            MessageS2CTransfer msgTransfer = new MessageS2CTransfer(entry.channel,
                contentToTransfer);
            msgTransfer.setClientID(clientid);
            msgTransfer.setProtocolVersion(msg.getProtocolVersion());
            netMan.sendMessage(msgTransfer);
          } else {
            logger.warn("Cannot transfer content (" + content.name
                    + ") because it is null");
          }
View Full Code Here

TOP

Related Classes of marauroa.common.net.message.MessageC2STransferACK

Copyright © 2018 www.massapicom. 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.