mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-07-11 10:35:43 +00:00
Remove request multiplexer (#3624)
* WIP: Get rid of request multiplexer. * WIP * Receiver for handling of incoming requests. * Get rid of useless `Fault` abstraction. The things the type system let us do are not worth getting abstracted in its own type. Instead error handling is going to be merely a pattern. * Make most things compile again. * Port availability distribution away from request multiplexer. * Formatting. * Port dispute distribution over. * Fixup statement distribution. * Handle request directly in collator protocol. + Only allow fatal errors at top level. * Use direct request channel for availability recovery. * Finally get rid of request multiplexer Fixes #2842 and paves the way for more back pressure possibilities. * Fix overseer and statement distribution tests. * Fix collator protocol and network bridge tests. * Fix tests in availability recovery. * Fix availability distribution tests. * Fix dispute distribution tests. * Add missing dependency * Typos. * Review remarks. * More remarks.
This commit is contained in:
@@ -22,9 +22,9 @@ use futures::{
|
||||
|
||||
use polkadot_node_network_protocol::{
|
||||
request_response::{
|
||||
request::OutgoingResponse,
|
||||
incoming::{self, OutgoingResponse},
|
||||
v1::{StatementFetchingRequest, StatementFetchingResponse},
|
||||
IncomingRequest, MAX_PARALLEL_STATEMENT_REQUESTS,
|
||||
IncomingRequestReceiver, MAX_PARALLEL_STATEMENT_REQUESTS,
|
||||
},
|
||||
PeerId, UnifiedReputationChange as Rep,
|
||||
};
|
||||
@@ -51,7 +51,7 @@ pub enum ResponderMessage {
|
||||
/// `CommittedCandidateReceipt` from peers, whether this can be used to re-assemble one ore
|
||||
/// many `SignedFullStatement`s needs to be verified by the caller.
|
||||
pub async fn respond(
|
||||
mut receiver: mpsc::Receiver<sc_network::config::IncomingRequest>,
|
||||
mut receiver: IncomingRequestReceiver<StatementFetchingRequest>,
|
||||
mut sender: mpsc::Sender<ResponderMessage>,
|
||||
) {
|
||||
let mut pending_out = FuturesUnordered::new();
|
||||
@@ -74,23 +74,16 @@ pub async fn respond(
|
||||
pending_out.next().await;
|
||||
}
|
||||
|
||||
let raw = match receiver.next().await {
|
||||
None => {
|
||||
tracing::debug!(target: LOG_TARGET, "Shutting down request responder");
|
||||
let req = match receiver.recv(|| vec![COST_INVALID_REQUEST]).await {
|
||||
Err(incoming::Error::Fatal(f)) => {
|
||||
tracing::debug!(target: LOG_TARGET, error = ?f, "Shutting down request responder");
|
||||
return
|
||||
},
|
||||
Some(v) => v,
|
||||
};
|
||||
|
||||
let req = match IncomingRequest::<StatementFetchingRequest>::try_from_raw(
|
||||
raw,
|
||||
vec![COST_INVALID_REQUEST],
|
||||
) {
|
||||
Err(err) => {
|
||||
Err(incoming::Error::NonFatal(err)) => {
|
||||
tracing::debug!(target: LOG_TARGET, ?err, "Decoding request failed");
|
||||
continue
|
||||
},
|
||||
Ok(payload) => payload,
|
||||
Ok(v) => v,
|
||||
};
|
||||
|
||||
let (tx, rx) = oneshot::channel();
|
||||
|
||||
Reference in New Issue
Block a user