#3815: Ensure ping response for unthrottling

This commit is contained in:
Outfluencer 2025-04-12 09:14:38 +02:00 committed by GitHub
parent 2516de6586
commit d7538df91b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -283,6 +283,7 @@ public class InitialHandler extends PacketHandler implements PendingConnection
public void handle(StatusRequest statusRequest) throws Exception public void handle(StatusRequest statusRequest) throws Exception
{ {
Preconditions.checkState( thisState == State.STATUS, "Not expecting STATUS" ); Preconditions.checkState( thisState == State.STATUS, "Not expecting STATUS" );
thisState = null; // don't accept multiple status requests and set state to ping in async event callback
ServerInfo forced = AbstractReconnectHandler.getForcedHost( this ); ServerInfo forced = AbstractReconnectHandler.getForcedHost( this );
final String motd = ( forced != null ) ? forced.getMotd() : listener.getMotd(); final String motd = ( forced != null ) ? forced.getMotd() : listener.getMotd();
@ -306,10 +307,7 @@ public class InitialHandler extends PacketHandler implements PendingConnection
{ {
Gson gson = PingHandler.gson; Gson gson = PingHandler.gson;
unsafe.sendPacket( new StatusResponse( gson.toJson( pingResult.getResponse() ) ) ); unsafe.sendPacket( new StatusResponse( gson.toJson( pingResult.getResponse() ) ) );
if ( bungee.getConnectionThrottle() != null ) thisState = State.PING;
{
bungee.getConnectionThrottle().unthrottle( getSocketAddress() );
}
} }
}; };
@ -324,8 +322,6 @@ public class InitialHandler extends PacketHandler implements PendingConnection
{ {
pingBack.done( getPingInfo( motd, protocol ), null ); pingBack.done( getPingInfo( motd, protocol ), null );
} }
thisState = State.PING;
} }
@Override @Override
@ -334,6 +330,10 @@ public class InitialHandler extends PacketHandler implements PendingConnection
Preconditions.checkState( thisState == State.PING, "Not expecting PING" ); Preconditions.checkState( thisState == State.PING, "Not expecting PING" );
unsafe.sendPacket( ping ); unsafe.sendPacket( ping );
disconnect( "" ); disconnect( "" );
if ( bungee.getConnectionThrottle() != null )
{
bungee.getConnectionThrottle().unthrottle( getSocketAddress() );
}
} }
@Override @Override