Fix bugs from recent performance enhancements #70
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.
Changes:
As a result of #69 there were some regressions that this PR fixes while maintaining major performance improvements.
One of the changes in the previous PR stopped us from allocating 64 bytes every time we read in a new packet. Unfortunately, that state is later used in other goroutines as various
[]byte
s are stored on the packet that point to the underlying byte array. This PR instead allocates 64 bytes for the workers which read from the UDP stream, but then allocates just enough memory for each packet and copies the read bytes over.A change to
DeriveKerberosKey
resulted in a regression for passwords shorter than 16 bytes. While almost all account passwords are 16 bytes as they are generated, the guest key which is hard coded in all NEX consoles uses a 12 byte key. This resulted in people who had not connected to the network before being unable to decrypt the kerberos key and failing to connect. This fix correctly initialises keys for passwords shorter than 16 bytes while retaining all of the performance benefits of the change. I've also added a test to make sure the guest key is generated properly