LilyPad / GoLilyPad

GNU General Public License v3.0
98 stars 58 forks source link

Configurable network compression threshold + fix threshold incorrectly matching in 1.9+ to server #69

Closed WesJD closed 2 years ago

WesJD commented 3 years ago

This PR contains:

  1. A fix for 1.9+ clients having their session's network compression threshold set to the server's. In 1.9+ the network compression threshold for the session is static in the proxy. Due to this combo, if someone changes their server's local network-compression-threshold to anything below the previously static 256, players get kicked for incorrectly compressed packets.
  2. The network compression threshold is now configurable in the proxy config for 1.9+ clients.
  3. When loading the config, the loading is now based on the default config in order to preserve the default values of options if the user failed to set them.
WesJD commented 3 years ago

After further testing, I'm experiencing some weird issues with this change. Perhaps I have missed a crucial part of fixing 1., as there is still kicking that occurs when the client <-> proxy and server <-> proxy thresholds do not match. Further, if the server compression threshold is set to -1 and the proxy threshold is set to 256, window click packets that contain a good amount of NBT data will cause the server to receive packets with IDs far above the maximum packet id, which then kicks the player (maybe due to an incorrect buffer size being reported somewhere when compression is off?). Will investigate more when I get time.

It was to my understanding that the compression between the proxy and server/client are separate, but maybe there is some sort of relationship I'm missing in the codebase.