Skip to content

fix compression packet handling for q2repro#6

Open
res2k wants to merge 1 commit intores2k:mainfrom
jackharrhy:notscared
Open

fix compression packet handling for q2repro#6
res2k wants to merge 1 commit intores2k:mainfrom
jackharrhy:notscared

Conversation

@res2k
Copy link
Copy Markdown
Owner

@res2k res2k commented Jan 25, 2026

  • ensure we write svc_q2repro_zdownload, rather than svc_r1q2_zdownload
  • handle deflate end so the stream resumes
  • ensure we use context->zpacket_cmd rather than hard-coding svc_r1q2_zpacket, which was incorrect

- ensure we write svc_q2repro_zdownload, rather than svc_r1q2_zdownload
- handle deflate end so the stream resumes
- ensure we use context->zpacket_cmd rather than hard-coding
  svc_r1q2_zpacket, which was incorrect
@res2k
Copy link
Copy Markdown
Owner Author

res2k commented Jan 25, 2026

@jackharrhy, I just stumbled upon those changes in your fork. Those look like legit bugs, so I took the liberty to open this PR.

// FIX(jackharrhy) q2protoio_deflate_get_data finishes the stream,
// so we need to end it and mark as invalid for the next packet
// (which will create a new stream)
q2protoio_deflate_end(state->deflate_io);
Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, one issue I have with this bit is that this basically means that each chunk of compressed download data is it's own, complete deflate stream; but I think the intention was to allow streams that span multiple packets.
(IIRC original q2pro does it like that for zdownloads).

It's also possible that q2repro's q2protoio_deflate_get_data() needs adjustment, or that some more communication between q2protoio_deflate_get_data() and it's callers are required - perhaps a return code that implied "end deflating".
(Although, this could also be tracked in the q2protoio_ implementation, which would mean addressing this in q2repro.)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this was the biggest reason i didn't really bother considering upstreaming this, as while this made things work again, it didn't feel like a great solution

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fair enough.
But the command fixes are already valuable, so I pulled those out and pushed them.
For now, I'd leave this PR open for discussion or perhaps future updates.

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jackharrhy So I arrived at a solution...
At it's core, the issue was that q2protoio_deflate_get_data() was really used for different purposes in different cases - mostly "one-shot" compression (finish immediatelty), but in the problematic code above, it was "streaming" compression (finish eventually).
To address this I added, well, an additional argument to indicate whether compression is to be "finished" (b2b4407).

Of course this also required changes in q2repro - see https://github.com/res2k/q2pro/commits/rerelease-game/; so you'll probably need to merge that should you update q2proto.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants