mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-27 04:37:57 +00:00
committed by
Bastian Köcher
parent
2e9b2be8fa
commit
90eef10d5c
@@ -118,12 +118,12 @@ pub enum NetworkStatePeerEndpoint {
|
||||
impl From<ConnectedPoint> for NetworkStatePeerEndpoint {
|
||||
fn from(endpoint: ConnectedPoint) -> Self {
|
||||
match endpoint {
|
||||
ConnectedPoint::Dialer { ref address } =>
|
||||
NetworkStatePeerEndpoint::Dialing(address.clone()),
|
||||
ConnectedPoint::Listener { ref listen_addr, ref send_back_addr } =>
|
||||
ConnectedPoint::Dialer { address } =>
|
||||
NetworkStatePeerEndpoint::Dialing(address),
|
||||
ConnectedPoint::Listener { listen_addr, send_back_addr } =>
|
||||
NetworkStatePeerEndpoint::Listening {
|
||||
listen_addr: listen_addr.clone(),
|
||||
send_back_addr: send_back_addr.clone()
|
||||
listen_addr: listen_addr,
|
||||
send_back_addr: send_back_addr
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@ use futures::{prelude::*, Stream};
|
||||
use libp2p::{multiaddr::Protocol, Multiaddr, PeerId, build_multiaddr};
|
||||
use libp2p::core::{Swarm, nodes::Substream, transport::boxed::Boxed, muxing::StreamMuxerBox};
|
||||
use libp2p::core::nodes::ConnectedPoint;
|
||||
use log::{debug, info, warn};
|
||||
use log::{debug, error, info, warn};
|
||||
use std::collections::hash_map::Entry;
|
||||
use std::fs;
|
||||
use std::io::{Error as IoError, ErrorKind as IoErrorKind};
|
||||
@@ -477,9 +477,12 @@ where TMessage: CustomMessage + Send + 'static {
|
||||
// have any open custom protocol slot. Therefore it is not necessarily in the
|
||||
// list.
|
||||
if let Some(id) = self.index_by_id.get(&peer_id) {
|
||||
self.nodes_info.get_mut(id)
|
||||
.expect("index_by_id and nodes_info are always kept in sync; QED")
|
||||
.client_version = Some(info.agent_version);
|
||||
if let Some(n) = self.nodes_info.get_mut(id) {
|
||||
n.client_version = Some(info.agent_version);
|
||||
} else {
|
||||
error!(target: "sub-libp2p",
|
||||
"State inconsistency between index_by_id and nodes_info");
|
||||
}
|
||||
}
|
||||
}
|
||||
Ok(Async::Ready(Some(BehaviourOut::PingSuccess { peer_id, ping_time }))) => {
|
||||
@@ -487,9 +490,12 @@ where TMessage: CustomMessage + Send + 'static {
|
||||
// have any open custom protocol slot. Therefore it is not necessarily in the
|
||||
// list.
|
||||
if let Some(id) = self.index_by_id.get(&peer_id) {
|
||||
self.nodes_info.get_mut(id)
|
||||
.expect("index_by_id and nodes_info are always kept in sync; QED")
|
||||
.latest_ping = Some(ping_time);
|
||||
if let Some(n) = self.nodes_info.get_mut(id) {
|
||||
n.latest_ping = Some(ping_time);
|
||||
} else {
|
||||
error!(target: "sub-libp2p",
|
||||
"State inconsistency between index_by_id and nodes_info");
|
||||
}
|
||||
}
|
||||
}
|
||||
Ok(Async::NotReady) => break Ok(Async::NotReady),
|
||||
|
||||
Reference in New Issue
Block a user