mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-07-03 21:37:23 +00:00
Rewrite network protocol/service to use channels (#1340)
* rewrite network protocol/service to use channels * remove use of unwrap * re-introduce with_spec * remove unnecessary mut * remove unused param * improve with_spec, add with_gossip * rename job to task * style: re-add comma * remove extra string allocs * rename use of channel * turn TODO into FIXME * remove mut in match * remove Self in new * pass headers by value to network service * remove network sender from service * remove TODO * better expect * rationalize use of network sender in ondemand
This commit is contained in:
committed by
Bastian Köcher
parent
8aae19e2db
commit
a2d2ed69ab
@@ -96,21 +96,21 @@ impl NetworkConfiguration {
|
||||
}
|
||||
|
||||
/// The severity of misbehaviour of a peer that is reported.
|
||||
#[derive(Debug, PartialEq, Eq, Clone, Copy)]
|
||||
pub enum Severity<'a> {
|
||||
#[derive(Debug, PartialEq, Eq, Clone)]
|
||||
pub enum Severity {
|
||||
/// Peer is timing out. Could be bad connectivity of overload of work on either of our sides.
|
||||
Timeout,
|
||||
/// Peer has been notably useless. E.g. unable to answer a request that we might reasonably consider
|
||||
/// it could answer.
|
||||
Useless(&'a str),
|
||||
Useless(String),
|
||||
/// Peer has behaved in an invalid manner. This doesn't necessarily need to be Byzantine, but peer
|
||||
/// must have taken concrete action in order to behave in such a way which is wantanly invalid.
|
||||
Bad(&'a str),
|
||||
Bad(String),
|
||||
}
|
||||
|
||||
impl<'a> fmt::Display for Severity<'a> {
|
||||
impl fmt::Display for Severity {
|
||||
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
|
||||
match *self {
|
||||
match self {
|
||||
Severity::Timeout => write!(fmt, "Timeout"),
|
||||
Severity::Useless(r) => write!(fmt, "Useless ({})", r),
|
||||
Severity::Bad(r) => write!(fmt, "Bad ({})", r),
|
||||
|
||||
Reference in New Issue
Block a user