Use async/await instead of manual polling of `NetworkWorker` (#13219)
* Convert `NetworkWorker::poll()` into async `next_action()` * Use `NetworkWorker::next_action` instead of `poll` in `sc-network-test` * Revert "Use `NetworkWorker::next_action` instead of `poll` in `sc-network-test`" This reverts commit 4b5d851ec864f78f9d083a18a618fbe117c896d2. * Fix `sc-network-test` to poll `NetworkWorker::next_action` * Fix `sc_network::service` tests to poll `NetworkWorker::next_action` * Fix docs * kick CI * Factor out `next_worker_message()` & `next_swarm_event()` * Error handling: replace `futures::pending!()` with `expect()` * Simplify stream polling in `select!` * Replace `NetworkWorker::next_action()` with `run()` * Apply suggestions from code review Co-authored-by:Bastian Köcher <git@kchr.de> * minor: comment * Apply suggestions from code review Co-authored-by:
Bastian Köcher <git@kchr.de> * Print debug log when network future is shut down * Evaluate `NetworkWorker::run()` future once before the loop * Fix client code to match new `NetworkService` interfaces * Make clippy happy * Apply suggestions from code review Co-authored-by:
Bastian Köcher <git@kchr.de> * Apply suggestions from code review Co-authored-by:
Bastian Köcher <git@kchr.de> * Revert "Apply suggestions from code review" This reverts commit 9fa646d0ed613e5f8623d3d37d1d59ec0a535850. * Make `NetworkWorker::run()` consume `self` * Terminate system RPC future if RPC rx stream has terminated. * Rewrite with let-else * Fix comments * Get `best_seen_block` and call `on_block_finalized` via `ChainSync` instead of `NetworkService` * rustfmt * make clippy happy * Tests: schedule wake if `next_action()` returned true * minor: comment * minor: fix `NetworkWorker` rustdoc * minor: amend the rustdoc * Fix bug that caused `on_demand_beefy_justification_sync` test to hang * rustfmt * Apply review suggestions --------- Co-authored-by:
Bastian Köcher <git@kchr.de>
Showing
- substrate/client/authority-discovery/src/worker/tests.rs 4 additions, 0 deletionssubstrate/client/authority-discovery/src/worker/tests.rs
- substrate/client/network/common/src/service.rs 9 additions, 2 deletionssubstrate/client/network/common/src/service.rs
- substrate/client/network/src/service.rs 600 additions, 590 deletionssubstrate/client/network/src/service.rs
- substrate/client/network/src/service/tests/chain_sync.rs 10 additions, 26 deletionssubstrate/client/network/src/service/tests/chain_sync.rs
- substrate/client/network/src/service/tests/mod.rs 1 addition, 4 deletionssubstrate/client/network/src/service/tests/mod.rs
- substrate/client/network/sync/src/lib.rs 6 additions, 0 deletionssubstrate/client/network/sync/src/lib.rs
- substrate/client/network/sync/src/service/chain_sync.rs 21 additions, 1 deletionsubstrate/client/network/sync/src/service/chain_sync.rs
- substrate/client/network/test/src/lib.rs 13 additions, 4 deletionssubstrate/client/network/test/src/lib.rs
- substrate/client/offchain/src/api.rs 4 additions, 0 deletionssubstrate/client/offchain/src/api.rs
- substrate/client/offchain/src/lib.rs 4 additions, 0 deletionssubstrate/client/offchain/src/lib.rs
- substrate/client/service/src/builder.rs 20 additions, 10 deletionssubstrate/client/service/src/builder.rs
- substrate/client/service/src/lib.rs 161 additions, 102 deletionssubstrate/client/service/src/lib.rs
Please register or sign in to comment