#2786: Should first peek keepalive queue

This commit is contained in:
MrIvanPlays 2020-05-26 19:45:36 +10:00 committed by md_5
parent 67c2dfd884
commit 2f54c94372

View File

@ -122,10 +122,11 @@ public class UpstreamBridge extends PacketHandler
@Override
public void handle(KeepAlive alive) throws Exception
{
KeepAliveData keepAliveData = con.getServer().getKeepAlives().poll();
KeepAliveData keepAliveData = con.getServer().getKeepAlives().peek();
if ( keepAliveData != null && alive.getRandomId() == keepAliveData.getId() )
{
Preconditions.checkState( keepAliveData == con.getServer().getKeepAlives().poll(), "keepalive queue mismatch" );
int newPing = (int) ( System.currentTimeMillis() - keepAliveData.getTime() );
con.getTabListHandler().onPingChange( newPing );
con.setPing( newPing );