Tone down logging for surprisingly large reduction in CPU usage - Closes #401

This commit is contained in:
md_5 2013-06-03 19:48:21 +10:00
parent ac5e8dbaff
commit fd411edddb
2 changed files with 18 additions and 3 deletions

View File

@ -10,6 +10,7 @@ import java.security.GeneralSecurityException;
import java.security.MessageDigest;
import java.util.ArrayList;
import java.util.List;
import java.util.logging.Level;
import javax.crypto.Cipher;
import javax.crypto.SecretKey;
import lombok.Getter;
@ -128,6 +129,9 @@ public class InitialHandler extends PacketHandler implements PendingConnection
public void handle(Packet2Handshake handshake) throws Exception
{
Preconditions.checkState( thisState == State.HANDSHAKE, "Not expecting HANDSHAKE" );
this.handshake = handshake;
bungee.getLogger().log( Level.INFO, "{0} has connected", this );
if ( handshake.getUsername().length() > 16 )
{
disconnect( "Cannot have username longer than 16 characters" );
@ -148,7 +152,6 @@ public class InitialHandler extends PacketHandler implements PendingConnection
return;
}
this.handshake = handshake;
unsafe().sendPacket( PacketConstants.I_AM_BUNGEE );
unsafe().sendPacket( PacketConstants.FORGE_MOD_REQUEST );
unsafe().sendPacket( request = EncryptionUtil.encryptRequest() );

View File

@ -6,8 +6,12 @@ import io.netty.channel.ChannelInboundMessageHandlerAdapter;
import io.netty.handler.timeout.ReadTimeoutException;
import java.io.IOException;
import java.util.logging.Level;
import net.md_5.bungee.ServerConnector;
import net.md_5.bungee.api.ProxyServer;
import net.md_5.bungee.connection.CancelSendSignal;
import net.md_5.bungee.connection.DownstreamBridge;
import net.md_5.bungee.connection.InitialHandler;
import net.md_5.bungee.connection.UpstreamBridge;
/**
* This class is a primitive wrapper for {@link PacketHandler} instances tied to
@ -33,7 +37,11 @@ public class HandlerBoss extends ChannelInboundMessageHandlerAdapter<Object>
{
channel = new ChannelWrapper( ctx.channel() );
handler.connected( channel );
ProxyServer.getInstance().getLogger().log( Level.INFO, "{0} has connected", handler );
if ( !( handler instanceof InitialHandler ) )
{
ProxyServer.getInstance().getLogger().log( Level.INFO, "{0} has connected", handler );
}
}
}
@ -42,8 +50,12 @@ public class HandlerBoss extends ChannelInboundMessageHandlerAdapter<Object>
{
if ( handler != null )
{
ProxyServer.getInstance().getLogger().log( Level.INFO, "{0} has disconnected", handler );
handler.disconnected( channel );
if ( !( handler instanceof InitialHandler ) )
{
ProxyServer.getInstance().getLogger().log( Level.INFO, "{0} has disconnected", handler );
}
}
}