mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-13 11:41:04 +00:00
Replace request-response incoming requests queue with async-channel (#14199)
This commit is contained in:
+3
-6
@@ -17,10 +17,7 @@
|
||||
//! Helper for handling (i.e. answering) BEEFY justifications requests from a remote peer.
|
||||
|
||||
use codec::Decode;
|
||||
use futures::{
|
||||
channel::{mpsc, oneshot},
|
||||
StreamExt,
|
||||
};
|
||||
use futures::{channel::oneshot, StreamExt};
|
||||
use log::{debug, trace};
|
||||
use sc_client_api::BlockBackend;
|
||||
use sc_network::{
|
||||
@@ -102,11 +99,11 @@ impl<B: Block> IncomingRequest<B> {
|
||||
///
|
||||
/// Takes care of decoding and handling of invalid encoded requests.
|
||||
pub(crate) struct IncomingRequestReceiver {
|
||||
raw: mpsc::Receiver<netconfig::IncomingRequest>,
|
||||
raw: async_channel::Receiver<netconfig::IncomingRequest>,
|
||||
}
|
||||
|
||||
impl IncomingRequestReceiver {
|
||||
pub fn new(inner: mpsc::Receiver<netconfig::IncomingRequest>) -> Self {
|
||||
pub fn new(inner: async_channel::Receiver<netconfig::IncomingRequest>) -> Self {
|
||||
Self { raw: inner }
|
||||
}
|
||||
|
||||
|
||||
@@ -23,7 +23,6 @@ pub(crate) mod outgoing_requests_engine;
|
||||
|
||||
pub use incoming_requests_handler::BeefyJustifsRequestHandler;
|
||||
|
||||
use futures::channel::mpsc;
|
||||
use std::time::Duration;
|
||||
|
||||
use codec::{Decode, Encode, Error as CodecError};
|
||||
@@ -54,7 +53,7 @@ pub(crate) fn on_demand_justifications_protocol_config<Hash: AsRef<[u8]>>(
|
||||
) -> (IncomingRequestReceiver, RequestResponseConfig) {
|
||||
let name = justifications_protocol_name(genesis_hash, fork_id);
|
||||
let fallback_names = vec![];
|
||||
let (tx, rx) = mpsc::channel(JUSTIF_CHANNEL_SIZE);
|
||||
let (tx, rx) = async_channel::bounded(JUSTIF_CHANNEL_SIZE);
|
||||
let rx = IncomingRequestReceiver::new(rx);
|
||||
let cfg = RequestResponseConfig {
|
||||
name,
|
||||
|
||||
Reference in New Issue
Block a user