mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-12 17:01:09 +00:00
Split Substrate messages into multiple substreams (#1796)
* Split Substrate messages into multiple substreams * Add back Clogged event
This commit is contained in:
committed by
Bastian Köcher
parent
dab5ad913f
commit
733ce7d616
@@ -129,7 +129,7 @@ pub struct RemoteReadResponse {
|
||||
/// Generic types.
|
||||
pub mod generic {
|
||||
use parity_codec::{Encode, Decode};
|
||||
use network_libp2p::CustomMessage;
|
||||
use network_libp2p::{CustomMessage, CustomMessageId};
|
||||
use runtime_primitives::Justification;
|
||||
use parity_codec_derive::{Encode, Decode};
|
||||
use crate::config::Roles;
|
||||
@@ -218,6 +218,26 @@ pub mod generic {
|
||||
fn from_bytes(bytes: &[u8]) -> Result<Self, ()> {
|
||||
Decode::decode(&mut &bytes[..]).ok_or(())
|
||||
}
|
||||
|
||||
fn request_id(&self) -> CustomMessageId {
|
||||
match *self {
|
||||
Message::Status(_) => CustomMessageId::OneWay,
|
||||
Message::BlockRequest(ref req) => CustomMessageId::Request(req.id),
|
||||
Message::BlockResponse(ref resp) => CustomMessageId::Response(resp.id),
|
||||
Message::BlockAnnounce(_) => CustomMessageId::OneWay,
|
||||
Message::Transactions(_) => CustomMessageId::OneWay,
|
||||
Message::Consensus(_) => CustomMessageId::OneWay,
|
||||
Message::RemoteCallRequest(ref req) => CustomMessageId::Request(req.id),
|
||||
Message::RemoteCallResponse(ref resp) => CustomMessageId::Response(resp.id),
|
||||
Message::RemoteReadRequest(ref req) => CustomMessageId::Request(req.id),
|
||||
Message::RemoteReadResponse(ref resp) => CustomMessageId::Response(resp.id),
|
||||
Message::RemoteHeaderRequest(ref req) => CustomMessageId::Request(req.id),
|
||||
Message::RemoteHeaderResponse(ref resp) => CustomMessageId::Response(resp.id),
|
||||
Message::RemoteChangesRequest(ref req) => CustomMessageId::Request(req.id),
|
||||
Message::RemoteChangesResponse(ref resp) => CustomMessageId::Response(resp.id),
|
||||
Message::ChainSpecific(_) => CustomMessageId::OneWay,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Status sent on connection.
|
||||
|
||||
Reference in New Issue
Block a user