mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-14 18:32:42 +00:00
Refactor inbound substream logic with async (#1325)
## Issue Addressed #1112 The logic is slightly different but still valid wrt to error handling. - Inbound state is either Busy with a future that return the subtream (and info about the processing) - The state machine works as follows: - `Idle` with pending responses => `Busy` - `Busy` => finished ? if so and there are new pending responses then `Busy`, if not then `Idle` => not finished remains `Busy` - Add an `InboundInfo` for readability - Other stuff: - Close inbound substreams when all expected responses are sent - Remove the error variants from `RPCCodedResponse` and use the codes instead - Fix various spelling mistakes because I got sloppy last time Sorry for the delay Co-authored-by: Age Manning <Age@AgeManning.com>
This commit is contained in:
@@ -323,12 +323,12 @@ impl<TSpec: EthSpec> RPCRequest<TSpec> {
|
||||
/* These functions are used in the handler for stream management */
|
||||
|
||||
/// Number of responses expected for this request.
|
||||
pub fn expected_responses(&self) -> usize {
|
||||
pub fn expected_responses(&self) -> u64 {
|
||||
match self {
|
||||
RPCRequest::Status(_) => 1,
|
||||
RPCRequest::Goodbye(_) => 0,
|
||||
RPCRequest::BlocksByRange(req) => req.count as usize,
|
||||
RPCRequest::BlocksByRoot(req) => req.block_roots.len(),
|
||||
RPCRequest::BlocksByRange(req) => req.count,
|
||||
RPCRequest::BlocksByRoot(req) => req.block_roots.len() as u64,
|
||||
RPCRequest::Ping(_) => 1,
|
||||
RPCRequest::MetaData(_) => 1,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user