Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

don't go further if connection is disconnected during handshake event #3617

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions proxy/src/main/java/net/md_5/bungee/connection/InitialHandler.java
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ public void done(ServerPing result, Throwable error)
@Override
public void done(ProxyPingEvent result, Throwable error)
{
if ( ch.isClosed() )
if ( ch.isClosing() )
{
return;
}
Expand Down Expand Up @@ -361,6 +361,12 @@ public void handle(Handshake handshake) throws Exception

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:
Expand Down Expand Up @@ -468,7 +474,7 @@ public void done(PreLoginEvent result, Throwable error)
disconnect( ( reason != null ) ? reason : TextComponent.fromLegacy( bungee.getTranslation( "kick_message" ) ) );
return;
}
if ( ch.isClosed() )
if ( ch.isClosing() )
{
return;
}
Expand Down Expand Up @@ -612,7 +618,7 @@ public void done(LoginEvent result, Throwable error)
disconnect( ( reason != null ) ? reason : TextComponent.fromLegacy( bungee.getTranslation( "kick_message" ) ) );
return;
}
if ( ch.isClosed() )
if ( ch.isClosing() )
{
return;
}
Expand Down Expand Up @@ -655,7 +661,7 @@ private void finish2()
bungee.getPluginManager().callEvent( new PostLoginEvent( userCon ) );

// #3612: Don't progress further if disconnected during event
if ( ch.isClosed() )
if ( ch.isClosing() )
{
return;
}
Expand Down