Remove HostTrait altogether (#8681)
This commit is contained in:
committed by
Marek Kotewicz
parent
2060ea5de3
commit
3d76417353
@@ -26,7 +26,7 @@ use node_table::NodeId;
|
||||
use io::{IoContext, StreamToken};
|
||||
use ethkey::{KeyPair, Public, Secret, recover, sign, Generator, Random};
|
||||
use ethkey::crypto::{ecdh, ecies};
|
||||
use network::{Error, ErrorKind, HostInfo as HostInfoTrait};
|
||||
use network::{Error, ErrorKind};
|
||||
use host::HostInfo;
|
||||
|
||||
#[derive(PartialEq, Eq, Debug)]
|
||||
|
||||
@@ -39,7 +39,6 @@ use PROTOCOL_VERSION;
|
||||
use node_table::*;
|
||||
use network::{NetworkConfiguration, NetworkIoMessage, ProtocolId, PeerId, PacketId};
|
||||
use network::{NonReservedPeerMode, NetworkContext as NetworkContextTrait};
|
||||
use network::HostInfo as HostInfoTrait;
|
||||
use network::{SessionInfo, Error, ErrorKind, DisconnectReason, NetworkProtocolHandler};
|
||||
use discovery::{Discovery, TableUpdates, NodeEntry};
|
||||
use ip_utils::{map_external_address, select_public_address};
|
||||
@@ -223,10 +222,8 @@ impl HostInfo {
|
||||
pub(crate) fn secret(&self) -> &Secret {
|
||||
self.keys.secret()
|
||||
}
|
||||
}
|
||||
|
||||
impl HostInfoTrait for HostInfo {
|
||||
fn id(&self) -> &NodeId {
|
||||
pub(crate) fn id(&self) -> &NodeId {
|
||||
self.keys.public()
|
||||
}
|
||||
}
|
||||
@@ -997,7 +994,6 @@ impl IoHandler<NetworkIoMessage> for Host {
|
||||
let reserved = self.reserved_nodes.read();
|
||||
h.initialize(
|
||||
&NetworkContext::new(io, *protocol, None, self.sessions.clone(), &reserved),
|
||||
&*self.info.read(),
|
||||
);
|
||||
self.handlers.write().insert(*protocol, h);
|
||||
let mut info = self.info.write();
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
//! struct MyHandler;
|
||||
//!
|
||||
//! impl NetworkProtocolHandler for MyHandler {
|
||||
//! fn initialize(&self, io: &NetworkContext, _host_info: &HostInfo) {
|
||||
//! fn initialize(&self, io: &NetworkContext) {
|
||||
//! io.register_timer(0, Duration::from_secs(1));
|
||||
//! }
|
||||
//!
|
||||
|
||||
@@ -28,7 +28,7 @@ use connection::{EncryptedConnection, Packet, Connection, MAX_PAYLOAD_SIZE};
|
||||
use handshake::Handshake;
|
||||
use io::{IoContext, StreamToken};
|
||||
use network::{Error, ErrorKind, DisconnectReason, SessionInfo, ProtocolId, PeerCapabilityInfo};
|
||||
use network::{SessionCapabilityInfo, HostInfo as HostInfoTrait};
|
||||
use network::SessionCapabilityInfo;
|
||||
use host::*;
|
||||
use node_table::NodeId;
|
||||
use snappy;
|
||||
|
||||
Reference in New Issue
Block a user