Skip to content

Preserve per-connection WebSocket compressor selection - #1955

Merged
uNetworkingAB merged 1 commit into
uNetworking:masterfrom
akorzynski:fix/dedicated-compressor-downgrade
Oct 5, 2026
Merged

uNetworkingAB merged 1 commit into
uNetworking:masterfrom
akorzynski:fix/dedicated-compressor-downgrade

Conversation

@akorzynski

@akorzynski akorzynski commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor

The 3 KB compatibility check used a bitwise overlap test. Every dedicated compressor setting shares bits with DEDICATED_COMPRESSOR_3KB, so the check silently replaced larger per-connection compressors with the 3 KB setting, which uses a 512-byte window and memLevel 1.

Mask the configured options with CompressOptions::_COMPRESSOR_MASK before comparing them with DEDICATED_COMPRESSOR_3KB. This keeps the 3 KB compatibility handling while allowing larger dedicated compressors to use their negotiated settings.

Replaying 1,500 recorded stage frames (7.8 MB) produced these compression ratios:

DEDICATED_COMPRESSOR_256KB 1.64x before, 7.90x after
DEDICATED_COMPRESSOR_8KB 1.64x before, 3.00x after
DEDICATED_COMPRESSOR_3KB 1.64x before, 1.64x after
SHARED_COMPRESSOR 4.65x before, 4.65x after

Every frame decompressed byte-for-byte after the change.

Developed with the help of Claude Code and OpenAI Codex.

Contributed by Spiderware (https://spiderware.gg).

The 3 KB compatibility check used a bitwise overlap test. Every dedicated
compressor setting shares bits with `DEDICATED_COMPRESSOR_3KB`, so the check
silently replaced larger per-connection compressors with the 3 KB setting,
which uses a 512-byte window and `memLevel` 1.

Mask the configured options with `CompressOptions::_COMPRESSOR_MASK` before
comparing them with `DEDICATED_COMPRESSOR_3KB`. This keeps the 3 KB compatibility
handling while allowing larger dedicated compressors to use their negotiated
settings.

Replaying 1,500 recorded stage frames (7.8 MB) produced these compression ratios:

  DEDICATED_COMPRESSOR_256KB  1.64x before, 7.90x after
  DEDICATED_COMPRESSOR_8KB    1.64x before, 3.00x after
  DEDICATED_COMPRESSOR_3KB    1.64x before, 1.64x after
  SHARED_COMPRESSOR           4.65x before, 4.65x after

Every frame decompressed byte-for-byte after the change.

Contributed by Spiderware (https://spiderware.gg).
@uNetworkingAB
uNetworkingAB merged commit 045bbc1 into uNetworking:master Oct 5, 2026
@akorzynski
akorzynski deleted the fix/dedicated-compressor-downgrade branch October 6, 2026 16:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants