Correctly handle jobs that can have multiple responses #12
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.
Some jobs can have multiple responses (such as
CMsgClientPICSProductInfoResponse
with itsresponse_pending
field). This commit handles this. I am not entirely happy with the code as it somewhat breaks the barrier between whatFilter
andConnectionTrait
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