XAsync: a failing Begin fails the call, and E_PENDING does not complete #55

Merged
gefydev merged 1 commit from upstream-pr/56 into main 2026-11-23 09:44:41 +00:00
gefydev commented 2026-11-22 23:03:07 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by gefydev on 2026-11-22T23:03:07Z.


Two differences from libHttpClient's AsyncLib.cpp in how xasync.rs reports results:

  • XAsyncBegin: when the provider's Begin fails, the call is completed with that error, and XCL also returned it from XAsyncBegin. libHttpClient returns S_OK there: the caller gets the error once, through the block. A title that treats a failed XAsyncBegin as "nothing was started" and frees the block, or retries, does so on a block that was already completed (and whose completion callback may already be queued). XAsyncRun likewise when its schedule fails.
  • XAsyncComplete(b, E_PENDING, ...): libHttpClient returns without completing ("E_PENDING is special -- if you still have work to do don't complete"). XCL turned it into E_FAIL and completed the call, ending an operation the provider meant to keep running.

Both now follow libHttpClient.

This is independent of #53 (which changes XAsyncCancel in the same file); the two merge without conflicts.

Validation

  • New tests a_failing_begin_fails_the_call_not_xasyncbegin and completing_with_e_pending_does_not_complete. On main both fail (XAsyncBegin returns E_FAIL; the status after XAsyncComplete(E_PENDING) is E_FAIL instead of E_PENDING).
  • cargo test -p xcl --lib: 345 passed, 0 failed, on Windows GNU under Wine.
<!-- greyfinch-sync:ivall/xcl:issue:6548966270 --> Imported from [ivall/xcl](https://github.com/xcl-dev/xcl/pull/56). Originally posted by [gefydev](https://github.com/gefydev) on 2026-11-22T23:03:07Z. --- Two differences from libHttpClient's `AsyncLib.cpp` in how `xasync.rs` reports results: - `XAsyncBegin`: when the provider's Begin fails, the call is completed with that error, and XCL also returned it from `XAsyncBegin`. libHttpClient returns `S_OK` there: the caller gets the error once, through the block. A title that treats a failed `XAsyncBegin` as "nothing was started" and frees the block, or retries, does so on a block that was already completed (and whose completion callback may already be queued). `XAsyncRun` likewise when its schedule fails. - `XAsyncComplete(b, E_PENDING, ...)`: libHttpClient returns without completing ("E_PENDING is special -- if you still have work to do don't complete"). XCL turned it into `E_FAIL` and completed the call, ending an operation the provider meant to keep running. Both now follow libHttpClient. This is independent of #53 (which changes `XAsyncCancel` in the same file); the two merge without conflicts. ## Validation - New tests `a_failing_begin_fails_the_call_not_xasyncbegin` and `completing_with_e_pending_does_not_complete`. On `main` both fail (`XAsyncBegin` returns `E_FAIL`; the status after `XAsyncComplete(E_PENDING)` is `E_FAIL` instead of `E_PENDING`). - `cargo test -p xcl --lib`: 345 passed, 0 failed, on Windows GNU under Wine.
upstream-sync closed this pull request 2026-11-24 06:56:57 +00:00
ivall commented 2026-11-24 07:00:25 +00:00 (Migrated from github.com)

Imported from ivall/xcl. Originally posted by ivall on 2026-11-23T09:45:15Z.


Merged (daa27b0). Follow-up in e38cb65: XAsyncSchedule on a terminated queue returns E_ABORT like XTaskQueueSubmitDelayedCallback after #57, so with this PR such an XAsyncRun / XCL operation fails through the block and its work never runs (test async_work_on_a_terminated_queue_is_aborted).

Tested on Windows 11 (RX 9070): cargo test --workspace green (lib 351, e2e), and a 45 s Unicorn Overlord run on the release build (VFS hooks active, ~60 fps, clean exit). Thanks!

<!-- greyfinch-sync:ivall/xcl:comment:7097052801 --> Imported from [ivall/xcl](https://github.com/ivall/xcl/pull/56#issuecomment-7097052801). Originally posted by [ivall](https://github.com/ivall) on 2026-11-23T09:45:15Z. --- Merged (daa27b0). Follow-up in e38cb65: `XAsyncSchedule` on a terminated queue returns `E_ABORT` like `XTaskQueueSubmitDelayedCallback` after #57, so with this PR such an `XAsyncRun` / XCL operation fails through the block and its work never runs (test `async_work_on_a_terminated_queue_is_aborted`). Tested on Windows 11 (RX 9070): `cargo test --workspace` green (lib 351, e2e), and a 45 s Unicorn Overlord run on the release build (VFS hooks active, ~60 fps, clean exit). Thanks!
Sign in to join this conversation.
No reviewers
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
xcl-dev/xcl!55
No description provided.