Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Correctly handle jobs that can have multiple responses #12

Merged
merged 1 commit into from
Sep 28, 2024

Conversation

ported-pw
Copy link
Contributor

Some jobs can have multiple responses (such as CMsgClientPICSProductInfoResponse with its response_pending field). This commit handles this. I am not entirely happy with the code as it somewhat breaks the barrier between what Filter and ConnectionTrait are supposed to handle, but I'm not sure a better solution exists within the current architecture.

The result/error type is also up for debate - we should probably return partially anyway even if there was an error, and let the user decide if they want it or not. Maybe we also want to return a broadcast::Receiver instead?

As a reference, see for example: https://github.com/SteamRE/SteamKit/blob/b4e4cb929b55c45bf262ab2b293be2424f81975a/SteamKit2/SteamKit2/Steam/Handlers/SteamApps/SteamApps.cs#L178

I guess this could be expanded to collect the data into a reasonable structure, but this would seem more suited to a high-level wrapper:
https://github.com/SteamRE/SteamKit/blob/master/SteamKit2/SteamKit2/Steam/Handlers/SteamApps/Callbacks.cs#L629

@icewind1991
Copy link
Owner

I wonder if we can have jobs marked with JobMultiple return the Vec from the regular job method instead of requiring a separate one. Maybe with some associated type magic.

@icewind1991
Copy link
Owner

I wonder if we can have jobs marked with JobMultiple return the Vec from the regular job method instead of requiring a separate one. Maybe with some associated type magic.

Couldn't figure out anything that wouldn't hurt ergonomics so lets just do it like this for now

@icewind1991 icewind1991 merged commit f802076 into icewind1991:main Sep 28, 2024
12 checks passed
@icewind1991
Copy link
Owner

I did change the job_multi function to return a Stream instead of a Vec

@ported-pw ported-pw deleted the multi-reponse-jobs branch October 9, 2024 20:14
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