Added debug.

This commit is contained in:
Mike 2020-05-09 22:41:43 +02:00
parent ee5a97bbae
commit a93ffbbbac

View File

@ -4,11 +4,17 @@ import com.eu.habbo.messages.ServerMessage;
import io.netty.buffer.ByteBuf;
import io.netty.channel.ChannelHandlerContext;
import io.netty.handler.codec.MessageToByteEncoder;
import io.netty.util.IllegalReferenceCountException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
public class GameServerMessageEncoder extends MessageToByteEncoder<ServerMessage> {
private static final Logger LOGGER = LoggerFactory.getLogger(GameServerMessageEncoder.class);
@Override
protected void encode(ChannelHandlerContext ctx, ServerMessage message, ByteBuf out) {
try {
ByteBuf buf = message.get();
try {
@ -17,6 +23,10 @@ public class GameServerMessageEncoder extends MessageToByteEncoder<ServerMessage
// Release copied buffer.
buf.release();
}
} catch (IllegalReferenceCountException e) {
LOGGER.error("IllegalReferenceCountException happened for packet {}.", message.getHeader());
throw e;
}
}
}