mirror of
https://github.com/fluencelabs/rust-libp2p
synced 2025-06-13 10:01:25 +00:00
Add an Error associated type to transports (#835)
* Add an Error associated type to transports * Improve raw swarm a bit * Rename map_other to map * Use source() instead of cause() * RawSwarmIncErr -> IncomingError
This commit is contained in:
@ -260,8 +260,7 @@ mod tests {
|
||||
use self::libp2p_tcp::TcpConfig;
|
||||
use futures::{Future, Stream};
|
||||
use libp2p_core::{PublicKey, Transport, upgrade::{apply_outbound, apply_inbound}};
|
||||
use std::sync::mpsc;
|
||||
use std::thread;
|
||||
use std::{io, sync::mpsc, thread};
|
||||
|
||||
#[test]
|
||||
fn correct_transfer() {
|
||||
@ -284,7 +283,8 @@ mod tests {
|
||||
.map_err(|(err, _)| err)
|
||||
.and_then(|(client, _)| client.unwrap().0)
|
||||
.and_then(|socket| {
|
||||
apply_inbound(socket, IdentifyProtocolConfig).map_err(|e| e.into_io_error())
|
||||
apply_inbound(socket, IdentifyProtocolConfig)
|
||||
.map_err(|e| io::Error::new(io::ErrorKind::Other, e))
|
||||
})
|
||||
.and_then(|sender| {
|
||||
sender.send(
|
||||
@ -308,9 +308,10 @@ mod tests {
|
||||
let transport = TcpConfig::new();
|
||||
|
||||
let future = transport.dial(rx.recv().unwrap())
|
||||
.unwrap_or_else(|_| panic!())
|
||||
.unwrap()
|
||||
.and_then(|socket| {
|
||||
apply_outbound(socket, IdentifyProtocolConfig).map_err(|e| e.into_io_error())
|
||||
apply_outbound(socket, IdentifyProtocolConfig)
|
||||
.map_err(|e| io::Error::new(io::ErrorKind::Other, e))
|
||||
})
|
||||
.and_then(|RemoteInfo { info, observed_addr, .. }| {
|
||||
assert_eq!(observed_addr, "/ip4/100.101.102.103/tcp/5000".parse().unwrap());
|
||||
|
Reference in New Issue
Block a user