Use client-generated request_async_id for Unity FFI async requests and replace delegate fan-out with pending callback dispatch#195
Merged
xianshijing-lk merged 2 commits intomainfrom Mar 20, 2026
Conversation
Contributor
|
Works for me, though I don't have a full picture yet how the whole life cycle of requests and response and callbacks work. I tested on my Mac. |
Contributor
Author
|
Thanks @MaxHeimbrock. We will need to do more tests once your example gets landed, and we will make more tests / examples before making a new release |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Description
This PR updates the Unity FFI async request path to use client-generated request_async_id end-to-end instead of relying on Rust-generated async_id for request/callback matching.
What changed
Why
Previously Unity sent the request first, then relied on Rust’s returned async_id to subscribe for the async callback. If Rust completed quickly, the callback could arrive before Unity had registered its listener.
This PR removes that race by:
It also improves callback dispatch efficiency by avoiding multicast delegate scans when many async requests are in flight.
Behavioral impact
Affected areas
Implementation notes
Testing