* @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");
}