mirror of
https://git.krews.org/morningstar/Arcturus-Community.git
synced 2024-11-27 08:50:51 +01:00
Added debug.
This commit is contained in:
parent
ee5a97bbae
commit
a93ffbbbac
@ -4,18 +4,28 @@ import com.eu.habbo.messages.ServerMessage;
|
|||||||
import io.netty.buffer.ByteBuf;
|
import io.netty.buffer.ByteBuf;
|
||||||
import io.netty.channel.ChannelHandlerContext;
|
import io.netty.channel.ChannelHandlerContext;
|
||||||
import io.netty.handler.codec.MessageToByteEncoder;
|
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> {
|
public class GameServerMessageEncoder extends MessageToByteEncoder<ServerMessage> {
|
||||||
|
|
||||||
|
private static final Logger LOGGER = LoggerFactory.getLogger(GameServerMessageEncoder.class);
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void encode(ChannelHandlerContext ctx, ServerMessage message, ByteBuf out) {
|
protected void encode(ChannelHandlerContext ctx, ServerMessage message, ByteBuf out) {
|
||||||
ByteBuf buf = message.get();
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
out.writeBytes(buf);
|
ByteBuf buf = message.get();
|
||||||
} finally {
|
|
||||||
// Release copied buffer.
|
try {
|
||||||
buf.release();
|
out.writeBytes(buf);
|
||||||
|
} finally {
|
||||||
|
// Release copied buffer.
|
||||||
|
buf.release();
|
||||||
|
}
|
||||||
|
} catch (IllegalReferenceCountException e) {
|
||||||
|
LOGGER.error("IllegalReferenceCountException happened for packet {}.", message.getHeader());
|
||||||
|
throw e;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user