Remove ConnectionInfo trait (#1813)

In all cases, we pass the PeerId directly as the connection info.
The flexbility of doing something different here was originally
envisioned but turned out to be never needed.

For reference see: https://github.com/libp2p/rust-libp2p/issues/1798#issuecomment-714526056

Co-authored-by: Max Inden <mail@max-inden.de>
This commit is contained in:
Thomas Eizinger
2020-10-31 01:51:27 +11:00
committed by GitHub
parent 421ae9d9c9
commit 335e55e60d
54 changed files with 555 additions and 589 deletions

View File

@ -31,8 +31,6 @@ use futures::prelude::*;
use futures::stream::FuturesUnordered;
use libp2p_core::{
Multiaddr,
PeerId,
ConnectionInfo,
Connected,
connection::{
ConnectionHandler,
@ -65,18 +63,17 @@ where
}
}
impl<TIntoProtoHandler, TProtoHandler, TConnInfo> IntoConnectionHandler<TConnInfo>
impl<TIntoProtoHandler, TProtoHandler> IntoConnectionHandler
for NodeHandlerWrapperBuilder<TIntoProtoHandler>
where
TIntoProtoHandler: IntoProtocolsHandler<Handler = TProtoHandler>,
TProtoHandler: ProtocolsHandler,
TConnInfo: ConnectionInfo<PeerId = PeerId>,
{
type Handler = NodeHandlerWrapper<TIntoProtoHandler::Handler>;
fn into_handler(self, connected: &Connected<TConnInfo>) -> Self::Handler {
fn into_handler(self, connected: &Connected) -> Self::Handler {
NodeHandlerWrapper {
handler: self.handler.into_handler(connected.peer_id(), &connected.endpoint),
handler: self.handler.into_handler(&connected.peer_id, &connected.endpoint),
negotiating_in: Default::default(),
negotiating_out: Default::default(),
queued_dial_upgrades: Vec::new(),