Setup encryption before possible disconnect#1754
Open
WouterGritter wants to merge 1 commit intoPaperMC:dev/3.0.0from
Open
Setup encryption before possible disconnect#1754WouterGritter wants to merge 1 commit intoPaperMC:dev/3.0.0from
WouterGritter wants to merge 1 commit intoPaperMC:dev/3.0.0from
Conversation
R00tB33rMan
approved these changes
Mar 30, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
There's no reason to delay setting up encryption to after we have fetched the
GameProfilefrom Mojang.Before this PR, this could result in a
disconnect()call before we had set up encryption if Mojang's servers are down:Simulating this with
throwable != null || true, we get disconnected on the client with a garbled exception message complaining about packets instead of the proper disconnect message. This is because as far as the client is concerned, encryption should already be in place.This PR moves enabling encryption on the connection right when we receive the packet and after we're done with setting up the crypto stuff.
This whole code block is already in a giant try/catch block:
which still results in the same behavior when
enableEncryption()fails (error log & disconnect), just without sending an unneeded fetch to Mojang.