mirror of
https://github.com/SpigotMC/BungeeCord.git
synced 2024-11-30 14:13:47 +01:00
#3190: Improve login protocol state machine
Prevents repetition of packets
This commit is contained in:
parent
06bf088d27
commit
1823f86dbb
@ -115,12 +115,12 @@ public class InitialHandler extends PacketHandler implements PendingConnection
|
|||||||
private enum State
|
private enum State
|
||||||
{
|
{
|
||||||
|
|
||||||
HANDSHAKE, STATUS, PING, USERNAME, ENCRYPT, FINISHED;
|
HANDSHAKE, STATUS, PING, USERNAME, ENCRYPT, FINISHING;
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean canSendKickMessage()
|
private boolean canSendKickMessage()
|
||||||
{
|
{
|
||||||
return thisState == State.USERNAME || thisState == State.ENCRYPT || thisState == State.FINISHED;
|
return thisState == State.USERNAME || thisState == State.ENCRYPT || thisState == State.FINISHING;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -392,12 +392,13 @@ public class InitialHandler extends PacketHandler implements PendingConnection
|
|||||||
}
|
}
|
||||||
if ( onlineMode )
|
if ( onlineMode )
|
||||||
{
|
{
|
||||||
|
thisState = State.ENCRYPT;
|
||||||
unsafe().sendPacket( request = EncryptionUtil.encryptRequest() );
|
unsafe().sendPacket( request = EncryptionUtil.encryptRequest() );
|
||||||
} else
|
} else
|
||||||
{
|
{
|
||||||
|
thisState = State.FINISHING;
|
||||||
finish();
|
finish();
|
||||||
}
|
}
|
||||||
thisState = State.ENCRYPT;
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -455,7 +456,7 @@ public class InitialHandler extends PacketHandler implements PendingConnection
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
thisState = State.FINISHING;
|
||||||
HttpClient.get( authURL, ch.getHandle().eventLoop(), handler );
|
HttpClient.get( authURL, ch.getHandle().eventLoop(), handler );
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -542,8 +543,6 @@ public class InitialHandler extends PacketHandler implements PendingConnection
|
|||||||
}
|
}
|
||||||
|
|
||||||
userCon.connect( server, null, true, ServerConnectEvent.Reason.JOIN_PROXY );
|
userCon.connect( server, null, true, ServerConnectEvent.Reason.JOIN_PROXY );
|
||||||
|
|
||||||
thisState = State.FINISHED;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} );
|
} );
|
||||||
|
Loading…
Reference in New Issue
Block a user