mirror of
https://github.com/SpigotMC/BungeeCord.git
synced 2024-11-16 15:25:21 +01:00
#3617: Don't go further if connection is disconnected during handshake event
Also replace all isClosed with isClosing as it is more accurate for disconnect calls in events.
This commit is contained in:
parent
17e23d5c3f
commit
25cf8d682b
@ -218,7 +218,7 @@ public class InitialHandler extends PacketHandler implements PendingConnection
|
||||
@Override
|
||||
public void done(ProxyPingEvent result, Throwable error)
|
||||
{
|
||||
if ( ch.isClosed() )
|
||||
if ( ch.isClosing() )
|
||||
{
|
||||
return;
|
||||
}
|
||||
@ -361,6 +361,12 @@ public class InitialHandler extends PacketHandler implements PendingConnection
|
||||
|
||||
bungee.getPluginManager().callEvent( new PlayerHandshakeEvent( InitialHandler.this, handshake ) );
|
||||
|
||||
// return if the connection was closed during the event
|
||||
if ( ch.isClosing() )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
switch ( handshake.getRequestedProtocol() )
|
||||
{
|
||||
case 1:
|
||||
@ -468,7 +474,7 @@ public class InitialHandler extends PacketHandler implements PendingConnection
|
||||
disconnect( ( reason != null ) ? reason : TextComponent.fromLegacy( bungee.getTranslation( "kick_message" ) ) );
|
||||
return;
|
||||
}
|
||||
if ( ch.isClosed() )
|
||||
if ( ch.isClosing() )
|
||||
{
|
||||
return;
|
||||
}
|
||||
@ -612,7 +618,7 @@ public class InitialHandler extends PacketHandler implements PendingConnection
|
||||
disconnect( ( reason != null ) ? reason : TextComponent.fromLegacy( bungee.getTranslation( "kick_message" ) ) );
|
||||
return;
|
||||
}
|
||||
if ( ch.isClosed() )
|
||||
if ( ch.isClosing() )
|
||||
{
|
||||
return;
|
||||
}
|
||||
@ -672,7 +678,7 @@ public class InitialHandler extends PacketHandler implements PendingConnection
|
||||
public void done(PostLoginEvent result, Throwable error)
|
||||
{
|
||||
// #3612: Don't progress further if disconnected during event
|
||||
if ( ch.isClosed() )
|
||||
if ( ch.isClosing() )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user