fix: register error callback in FFI CLI binary#575
fix: register error callback in FFI CLI binary#575xdustinface wants to merge 2 commits intorefactor/move-callbacks-to-cratesfrom
Conversation
Introduce `EventHandler` trait in `dash-spv` with default no-op methods and make `DashSpvClient` generic over it (`H: EventHandler`, default `()`). The handler is passed at construction time and stored as `Arc<H>`: - `DashSpvClient::new()` takes `Arc<H>` and emits initial progress via `on_progress()` immediately after construction - `run()` subscribes to internal channels and dispatches events to the stored handler via monitoring tasks — no handler parameter needed - `impl EventHandler for ()` provides a zero-cost no-op default - `FFIEventCallbacks` implements `EventHandler` directly, eliminating the `FFIEventHandler` wrapper - FFI: callbacks pass to `dash_spv_ffi_client_new()`, `run()` is parameter-less - Add `TestEventHandler` that bridges events back to tokio channels for ergonomic `select!`-based integration tests - Add `LoggingEventHandler` to CLI binary
Without `on_error`, fatal errors from the background sync task were silently swallowed and the CLI would hang waiting for Ctrl+C.
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## refactor/move-callbacks-to-crates #575 +/- ##
=====================================================================
+ Coverage 66.32% 66.50% +0.18%
=====================================================================
Files 311 312 +1
Lines 64976 65024 +48
=====================================================================
+ Hits 43097 43246 +149
+ Misses 21879 21778 -101
|
aaddece to
23accc0
Compare
|
This PR has merge conflicts with the base branch. Please rebase or merge the base branch into your branch to resolve them. |
Without
on_error, fatal errors from the background sync task were silently swallowed and the CLI would hang waiting for Ctrl+C.Based on:
DashSpvClient#572