We can now get pings!

This commit is contained in:
md_5 2013-03-09 09:54:19 +11:00
parent 45c848a4fd
commit 8a96555cc7
4 changed files with 8 additions and 4 deletions

View File

@ -187,11 +187,11 @@ public class BungeeCord extends ProxyServer
for ( ListenerInfo info : config.getListeners() )
{
Channel server = new ServerBootstrap()
.channel( NioServerSocketChannel.class)
.channel( NioServerSocketChannel.class )
.childAttr( PipelineUtils.LISTENER, info )
.childHandler( PipelineUtils.SERVER_CHILD )
.group( eventLoops )
.localAddress( info.getHost() )
.attr( PipelineUtils.LISTENER, info)
.bind().channel();
listeners.add( server );

View File

@ -60,6 +60,7 @@ public class HandlerBoss extends ChannelInboundMessageHandlerAdapter<ByteBuf>
@Override
public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception
{
super.exceptionCaught( ctx, cause );
if ( ctx.channel().isActive() )
{
ctx.close();

View File

@ -27,7 +27,10 @@ public class PacketDecoder extends ReplayingDecoder<ByteBuf>
@Override
protected ByteBuf decode(ChannelHandlerContext ctx, ByteBuf in) throws Exception
{
int startIndex = in.readerIndex();
PacketReader.readPacket( in, protocol );
return in.copy();
ByteBuf readPacket = in.copy( startIndex, in.readerIndex() - startIndex );
System.out.println( readPacket );
return readPacket;
}
}

View File

@ -88,7 +88,7 @@ public abstract class DefinedPacket implements ByteBuf
public static DefinedPacket packet(ByteBuf buf)
{
int id = buf.getUnsignedShort( 0 );
short id = buf.getUnsignedByte( 0 );
Class<? extends DefinedPacket> clazz = classes[id];
DefinedPacket ret = null;
if ( clazz != null )