Downgrade to Netty CR9

This commit is contained in:
md_5 2013-08-02 07:30:30 +10:00
parent 1f38152530
commit 4c4cdd51a1
8 changed files with 14 additions and 25 deletions

View File

@ -59,7 +59,7 @@
<properties>
<build.number>unknown</build.number>
<netty.version>4.0.4.Final</netty.version>
<netty.version>4.0.0.CR9</netty.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>

View File

@ -167,14 +167,14 @@ public class BungeeCord extends ProxyServer
public static void main(String[] args) throws Exception
{
Calendar deadline = Calendar.getInstance();
deadline.set( 2013, 8, 12 ); // year, month, date
deadline.set( 2013, 8, 4 ); // year, month, date
if ( Calendar.getInstance().after( deadline ) )
{
System.err.println( "*** Warning, this build is outdated ***" );
System.err.println( "*** Please download a new build from http://ci.md-5.net/job/BungeeCord ***" );
System.err.println( "*** You will get NO support regarding this build ***" );
System.err.println( "*** Server will start in 15 seconds ***" );
Thread.sleep( TimeUnit.SECONDS.toMillis( 15 ) );
System.err.println( "*** Server will start in 30 seconds ***" );
Thread.sleep( TimeUnit.SECONDS.toMillis( 30 ) );
}
BungeeCord bungee = new BungeeCord();

View File

@ -63,7 +63,7 @@ public class HttpClient
HttpRequest request = new DefaultHttpRequest( HttpVersion.HTTP_1_1, HttpMethod.GET, path );
request.headers().set( HttpHeaders.Names.HOST, uri.getHost() );
future.channel().writeAndFlush( request );
future.channel().write( request );
} else
{
callback.done( null, future.cause() );

View File

@ -31,7 +31,7 @@ public class HttpHandler extends SimpleChannelInboundHandler<HttpObject>
}
@Override
protected void channelRead0(ChannelHandlerContext ctx, HttpObject msg) throws Exception
protected void messageReceived(ChannelHandlerContext ctx, HttpObject msg) throws Exception
{
if ( msg instanceof HttpResponse )
{

View File

@ -22,7 +22,7 @@ public class ChannelWrapper
{
if ( !closed )
{
ch.writeAndFlush( packet );
ch.write( packet );
}
}
@ -31,7 +31,6 @@ public class ChannelWrapper
if ( !closed )
{
closed = true;
ch.flush();
ch.close();
}
}
@ -39,7 +38,6 @@ public class ChannelWrapper
public void addBefore(String baseName, String name, ChannelHandler handler)
{
Preconditions.checkState( ch.eventLoop().inEventLoop(), "cannot add handler outside of event loop" );
ch.pipeline().flush();
ch.pipeline().addBefore( baseName, name, handler );
}

View File

@ -2,8 +2,8 @@ package net.md_5.bungee.netty;
import io.netty.buffer.ByteBuf;
import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.MessageList;
import io.netty.handler.codec.MessageToMessageDecoder;
import java.util.List;
import javax.crypto.Cipher;
public class CipherDecoder extends MessageToMessageDecoder<ByteBuf>
@ -17,7 +17,7 @@ public class CipherDecoder extends MessageToMessageDecoder<ByteBuf>
}
@Override
protected void decode(ChannelHandlerContext ctx, ByteBuf msg, List<Object> out) throws Exception
protected void decode(ChannelHandlerContext ctx, ByteBuf msg, MessageList<Object> out) throws Exception
{
out.add( cipher.cipher( ctx, msg ) );
}

View File

@ -3,10 +3,9 @@ package net.md_5.bungee.netty;
import com.google.common.base.Preconditions;
import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.ChannelInboundHandlerAdapter;
import io.netty.channel.MessageList;
import io.netty.handler.timeout.ReadTimeoutException;
import java.io.IOException;
import java.util.ArrayDeque;
import java.util.Queue;
import java.util.logging.Level;
import net.md_5.bungee.BungeeCord;
import net.md_5.bungee.api.ProxyServer;
@ -24,7 +23,6 @@ public class HandlerBoss extends ChannelInboundHandlerAdapter
private ChannelWrapper channel;
private PacketHandler handler;
private final Queue<Object> msgs = new ArrayDeque<>();
public void setHandler(PacketHandler handler)
{
@ -68,17 +66,10 @@ public class HandlerBoss extends ChannelInboundHandlerAdapter
}
@Override
public void channelRead(ChannelHandlerContext ctx, Object msg) throws Exception
public void messageReceived(ChannelHandlerContext ctx, MessageList<Object> msgs) throws Exception
{
msgs.add( msg );
}
@Override
public void channelReadComplete(ChannelHandlerContext ctx) throws Exception
{
while ( !msgs.isEmpty() )
for ( Object msg : msgs )
{
Object msg = msgs.remove();
if ( handler != null )
{
if ( msg instanceof PacketWrapper )

View File

@ -2,8 +2,8 @@ package net.md_5.bungee.netty;
import io.netty.buffer.ByteBuf;
import io.netty.channel.ChannelHandlerContext;
import io.netty.channel.MessageList;
import io.netty.handler.codec.ReplayingDecoder;
import java.util.List;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.Setter;
@ -28,7 +28,7 @@ public class PacketDecoder extends ReplayingDecoder<Void>
private Protocol protocol;
@Override
protected void decode(ChannelHandlerContext ctx, ByteBuf in, List<Object> out) throws Exception
protected void decode(ChannelHandlerContext ctx, ByteBuf in, MessageList<Object> out) throws Exception
{
// While we have enough data
while ( true )