mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-13 04:41:02 +00:00
libp2p-0.5.0 (#1971)
* Update libp2p. Add support for ed25519 node (network) keys. * Update networking to the changes from https://github.com/libp2p/rust-libp2p/pull/972. * Add support for using ed25519 keys for libp2p networking. * Add support for reading libp2p secret keys from (external) files. * Adapt to changes from https://github.com/libp2p/rust-libp2p/pull/992 * More tests. * Cosmetics * Deduplicate tests. * Remove quickcheck from tests that don't use extra random inputs. * Remove quickcheck. * Swap new/default impls for NetworkConfiguration. * Use libp2p-0.5.0 from crates.io. * Post-rebase update. * Remove unnecessary wildcard pattern. * Combine two overlapping tests.
This commit is contained in:
@@ -25,7 +25,7 @@ use libp2p::identify::{Identify, IdentifyEvent, protocol::IdentifyInfo};
|
||||
use libp2p::kad::{Kademlia, KademliaOut, KadConnectionType};
|
||||
use libp2p::ping::{Ping, PingEvent};
|
||||
use log::{debug, trace, warn};
|
||||
use std::{cmp, io, time::Duration, time::Instant};
|
||||
use std::{cmp, io, fmt, time::Duration, time::Instant};
|
||||
use tokio_io::{AsyncRead, AsyncWrite};
|
||||
use tokio_timer::Delay;
|
||||
use void;
|
||||
@@ -445,3 +445,26 @@ where
|
||||
}
|
||||
}
|
||||
|
||||
/// The severity of misbehaviour of a peer that is reported.
|
||||
#[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(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(String),
|
||||
}
|
||||
|
||||
impl fmt::Display for Severity {
|
||||
fn fmt(&self, fmt: &mut fmt::Formatter) -> fmt::Result {
|
||||
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