#2762: Work correctly with disabled timeout

This commit is contained in:
md_5 2020-01-28 20:35:53 +11:00
parent 3ce4132c58
commit d3bd785289

View File

@ -125,7 +125,8 @@ public class DownstreamBridge extends PacketHandler
@Override @Override
public void handle(KeepAlive alive) throws Exception public void handle(KeepAlive alive) throws Exception
{ {
if ( server.getKeepAlives().size() < bungee.getConfig().getTimeout() / 50 ) // Allow a theoretical maximum of 1 keepalive per tick int timeout = bungee.getConfig().getTimeout();
if ( timeout <= 0 || server.getKeepAlives().size() < timeout / 50 ) // Some people disable timeout, otherwise allow a theoretical maximum of 1 keepalive per tick
{ {
server.getKeepAlives().add( new KeepAliveData( alive.getRandomId(), System.currentTimeMillis() ) ); server.getKeepAlives().add( new KeepAliveData( alive.getRandomId(), System.currentTimeMillis() ) );
} }