#1841: Fix disabled throttle and improve code.
This commit is contained in:
parent
2e8ed1cfba
commit
1cd3e42182
@ -270,7 +270,10 @@ public class BungeeCord extends ProxyServer
|
|||||||
|
|
||||||
pluginManager.enablePlugins();
|
pluginManager.enablePlugins();
|
||||||
|
|
||||||
connectionThrottle = new ConnectionThrottle( config.getThrottle() );
|
if ( config.getThrottle() > 0 )
|
||||||
|
{
|
||||||
|
connectionThrottle = new ConnectionThrottle( config.getThrottle() );
|
||||||
|
}
|
||||||
startListeners();
|
startListeners();
|
||||||
|
|
||||||
saveThread.scheduleAtFixedRate( new TimerTask()
|
saveThread.scheduleAtFixedRate( new TimerTask()
|
||||||
|
@ -13,7 +13,7 @@ public class ConnectionThrottle
|
|||||||
|
|
||||||
public ConnectionThrottle(int throttleTime)
|
public ConnectionThrottle(int throttleTime)
|
||||||
{
|
{
|
||||||
this.throttleTime = throttleTime;
|
this.throttleTime = throttleTime;
|
||||||
this.throttle = CacheBuilder.newBuilder()
|
this.throttle = CacheBuilder.newBuilder()
|
||||||
.concurrencyLevel( Runtime.getRuntime().availableProcessors() )
|
.concurrencyLevel( Runtime.getRuntime().availableProcessors() )
|
||||||
.initialCapacity( 100 )
|
.initialCapacity( 100 )
|
||||||
|
@ -296,7 +296,7 @@ public class InitialHandler extends PacketHandler implements PendingConnection
|
|||||||
thisState = State.USERNAME;
|
thisState = State.USERNAME;
|
||||||
ch.setProtocol( Protocol.LOGIN );
|
ch.setProtocol( Protocol.LOGIN );
|
||||||
|
|
||||||
if ( bungee.getConnectionThrottle().throttle( ( (InetSocketAddress) ch.getHandle().remoteAddress() ).getAddress() ) )
|
if ( bungee.getConnectionThrottle() != null && bungee.getConnectionThrottle().throttle( getAddress().getAddress() ) )
|
||||||
{
|
{
|
||||||
disconnect( bungee.getTranslation( "join_throttle_kick", TimeUnit.MILLISECONDS.toSeconds( bungee.getConfig().getThrottle() ) ) );
|
disconnect( bungee.getTranslation( "join_throttle_kick", TimeUnit.MILLISECONDS.toSeconds( bungee.getConfig().getThrottle() ) ) );
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user