mirror of
https://github.com/fluencelabs/rust-libp2p
synced 2025-06-28 09:11:34 +00:00
New core (#568)
* New core * Fix lifetime requirements * Remove identify transport * Address &mut & ref ref mut * Fix whitespaces
This commit is contained in:
@ -128,13 +128,12 @@ impl Into<protobuf_structs::dht::Message_Peer> for KadPeer {
|
||||
#[derive(Debug, Default, Copy, Clone)]
|
||||
pub struct KademliaProtocolConfig;
|
||||
|
||||
impl<C, Maf> ConnectionUpgrade<C, Maf> for KademliaProtocolConfig
|
||||
impl<C> ConnectionUpgrade<C> for KademliaProtocolConfig
|
||||
where
|
||||
C: AsyncRead + AsyncWrite + 'static, // TODO: 'static :-/
|
||||
{
|
||||
type Output = KadStreamSink<C>;
|
||||
type MultiaddrFuture = Maf;
|
||||
type Future = future::FutureResult<(Self::Output, Self::MultiaddrFuture), IoError>;
|
||||
type Future = future::FutureResult<Self::Output, IoError>;
|
||||
type NamesIter = iter::Once<(Bytes, ())>;
|
||||
type UpgradeIdentifier = ();
|
||||
|
||||
@ -144,8 +143,8 @@ where
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn upgrade(self, incoming: C, _: (), _: Endpoint, addr: Maf) -> Self::Future {
|
||||
future::ok((kademlia_protocol(incoming), addr))
|
||||
fn upgrade(self, incoming: C, _: (), _: Endpoint) -> Self::Future {
|
||||
future::ok(kademlia_protocol(incoming))
|
||||
}
|
||||
}
|
||||
|
||||
@ -489,7 +488,7 @@ mod tests {
|
||||
let future = listener
|
||||
.into_future()
|
||||
.map_err(|(err, _)| err)
|
||||
.and_then(|(client, _)| client.unwrap().map(|v| v.0))
|
||||
.and_then(|(client, _)| client.unwrap().0)
|
||||
.and_then(|proto| proto.into_future().map_err(|(err, _)| err).map(|(v, _)| v))
|
||||
.map(|recv_msg| {
|
||||
assert_eq!(recv_msg.unwrap(), msg_server);
|
||||
@ -504,7 +503,7 @@ mod tests {
|
||||
let future = transport
|
||||
.dial(rx.recv().unwrap())
|
||||
.unwrap_or_else(|_| panic!())
|
||||
.and_then(|proto| proto.0.send(msg_client))
|
||||
.and_then(|proto| proto.send(msg_client))
|
||||
.map(|_| ());
|
||||
|
||||
let _ = tokio_current_thread::block_on_all(future).unwrap();
|
||||
|
Reference in New Issue
Block a user