mirror of
https://github.com/fluencelabs/rust-libp2p
synced 2025-06-21 22:01:34 +00:00
Several changes.
- Pin `futures_codec` to version 0.3.3 as later versions require at least bytes-0.5 which he have not upgraded to yet. - Replace `futures::executor::block_on` with `async_std::task::block_on` where `async-std` is already a dependency to work around an issue with `park`/`unpark` behaviour. - Use the published version of `quicksink`.
This commit is contained in:
@ -358,7 +358,7 @@ mod tests {
|
||||
|
||||
#[test]
|
||||
fn incoming_event() {
|
||||
futures::executor::block_on(async move {
|
||||
async_std::task::block_on(async move {
|
||||
let mem_transport = transport::MemoryTransport::default();
|
||||
|
||||
let mut listeners = ListenersStream::new(mem_transport);
|
||||
|
@ -113,7 +113,7 @@ fn deny_incoming_connec() {
|
||||
|
||||
swarm1.listen_on("/ip4/127.0.0.1/tcp/0".parse().unwrap()).unwrap();
|
||||
|
||||
let address = futures::executor::block_on(future::poll_fn(|cx| {
|
||||
let address = async_std::task::block_on(future::poll_fn(|cx| {
|
||||
if let Poll::Ready(NetworkEvent::NewListenerAddress { listen_addr, .. }) = swarm1.poll(cx) {
|
||||
Poll::Ready(listen_addr)
|
||||
} else {
|
||||
@ -126,7 +126,7 @@ fn deny_incoming_connec() {
|
||||
.into_not_connected().unwrap()
|
||||
.connect(address.clone(), TestHandler::default().into_node_handler_builder());
|
||||
|
||||
futures::executor::block_on(future::poll_fn(|cx| -> Poll<Result<(), io::Error>> {
|
||||
async_std::task::block_on(future::poll_fn(|cx| -> Poll<Result<(), io::Error>> {
|
||||
match swarm1.poll(cx) {
|
||||
Poll::Ready(NetworkEvent::IncomingConnection(inc)) => drop(inc),
|
||||
Poll::Ready(_) => unreachable!(),
|
||||
@ -182,7 +182,7 @@ fn dial_self() {
|
||||
|
||||
swarm.listen_on("/ip4/127.0.0.1/tcp/0".parse().unwrap()).unwrap();
|
||||
|
||||
let (address, mut swarm) = futures::executor::block_on(
|
||||
let (address, mut swarm) = async_std::task::block_on(
|
||||
future::lazy(move |cx| {
|
||||
if let Poll::Ready(NetworkEvent::NewListenerAddress { listen_addr, .. }) = swarm.poll(cx) {
|
||||
Ok::<_, void::Void>((listen_addr, swarm))
|
||||
@ -196,7 +196,7 @@ fn dial_self() {
|
||||
|
||||
let mut got_dial_err = false;
|
||||
let mut got_inc_err = false;
|
||||
futures::executor::block_on(future::poll_fn(|cx| -> Poll<Result<(), io::Error>> {
|
||||
async_std::task::block_on(future::poll_fn(|cx| -> Poll<Result<(), io::Error>> {
|
||||
loop {
|
||||
match swarm.poll(cx) {
|
||||
Poll::Ready(NetworkEvent::UnknownPeerDialError {
|
||||
@ -284,7 +284,7 @@ fn multiple_addresses_err() {
|
||||
.connect_iter(addresses.clone(), TestHandler::default().into_node_handler_builder())
|
||||
.unwrap();
|
||||
|
||||
futures::executor::block_on(future::poll_fn(|cx| -> Poll<Result<(), io::Error>> {
|
||||
async_std::task::block_on(future::poll_fn(|cx| -> Poll<Result<(), io::Error>> {
|
||||
loop {
|
||||
match swarm.poll(cx) {
|
||||
Poll::Ready(NetworkEvent::DialError {
|
||||
|
@ -280,7 +280,7 @@ fn raw_swarm_simultaneous_connect() {
|
||||
}
|
||||
});
|
||||
|
||||
if futures::executor::block_on(future) {
|
||||
if async_std::task::block_on(future) {
|
||||
// The test exercised what we wanted to exercise: a simultaneous connect.
|
||||
break
|
||||
}
|
||||
|
@ -13,7 +13,7 @@ categories = ["network-programming", "asynchronous"]
|
||||
bytes = "0.4.5"
|
||||
fnv = "1.0"
|
||||
futures = "0.3.1"
|
||||
futures_codec = "0.3.1"
|
||||
futures_codec = "= 0.3.3"
|
||||
libp2p-core = { version = "0.13.0", path = "../../core" }
|
||||
log = "0.4"
|
||||
parking_lot = "0.9"
|
||||
|
@ -11,7 +11,7 @@ categories = ["network-programming", "asynchronous"]
|
||||
|
||||
[dependencies]
|
||||
bytes = "0.4"
|
||||
futures_codec = "0.3.1"
|
||||
futures_codec = "= 0.3.3"
|
||||
futures = "0.3.1"
|
||||
libp2p-core = { version = "0.13.0", path = "../../core" }
|
||||
libp2p-swarm = { version = "0.3.0", path = "../../swarm" }
|
||||
|
@ -315,7 +315,7 @@ mod tests {
|
||||
// it will permit the connection to be closed, as defined by
|
||||
// `IdentifyHandler::connection_keep_alive`. Hence the test succeeds if
|
||||
// either `Identified` event arrives correctly.
|
||||
futures::executor::block_on(async move {
|
||||
async_std::task::block_on(async move {
|
||||
loop {
|
||||
match future::select(swarm1.next(), swarm2.next()).await.factor_second().0 {
|
||||
future::Either::Left(Some(Ok(IdentifyEvent::Received { info, .. }))) => {
|
||||
|
@ -14,7 +14,7 @@ arrayvec = "0.5.1"
|
||||
bytes = "0.4"
|
||||
either = "1.5"
|
||||
fnv = "1.0"
|
||||
futures_codec = "0.3.1"
|
||||
futures_codec = "= 0.3.3"
|
||||
futures = "0.3.1"
|
||||
log = "0.4"
|
||||
libp2p-core = { version = "0.13.0", path = "../../core" }
|
||||
|
@ -282,7 +282,7 @@ mod tests {
|
||||
fn tick(h: &mut PingHandler<TcpStream>)
|
||||
-> ProtocolsHandlerEvent<protocol::Ping, (), PingResult, PingFailure>
|
||||
{
|
||||
futures::executor::block_on(future::poll_fn(|cx| h.poll(cx) ))
|
||||
async_std::task::block_on(future::poll_fn(|cx| h.poll(cx) ))
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
@ -84,7 +84,7 @@ fn ping() {
|
||||
};
|
||||
|
||||
let result = future::select(Box::pin(peer1), Box::pin(peer2));
|
||||
let ((p1, p2, rtt), _) = futures::executor::block_on(result).factor_first();
|
||||
let ((p1, p2, rtt), _) = async_std::task::block_on(result).factor_first();
|
||||
assert!(p1 == peer1_id && p2 == peer2_id || p1 == peer2_id && p2 == peer1_id);
|
||||
assert!(rtt < Duration::from_millis(50));
|
||||
}
|
||||
|
@ -12,7 +12,7 @@ categories = ["network-programming", "asynchronous"]
|
||||
[dependencies]
|
||||
bytes = "0.4.12"
|
||||
futures = "0.3.1"
|
||||
futures_codec = "0.3.1"
|
||||
futures_codec = "= 0.3.3"
|
||||
libp2p-core = { version = "0.13.0", path = "../../core" }
|
||||
log = "0.4.8"
|
||||
protobuf = "2.8.1"
|
||||
|
@ -19,7 +19,7 @@ lazy_static = "1.2.0"
|
||||
libp2p-core = { version = "0.13.0", path = "../../core" }
|
||||
log = "0.4.6"
|
||||
protobuf = "2.8"
|
||||
quicksink = { git = "https://github.com/paritytech/quicksink.git" }
|
||||
quicksink = "0.1"
|
||||
rand = "0.7"
|
||||
rw-stream-sink = { version = "0.1.1", path = "../../misc/rw-stream-sink" }
|
||||
sha2 = "0.8.0"
|
||||
|
@ -156,7 +156,7 @@ mod tests {
|
||||
);
|
||||
|
||||
let data = b"hello world";
|
||||
futures::executor::block_on(async move {
|
||||
async_std::task::block_on(async move {
|
||||
encoder.send(data.to_vec()).await.unwrap();
|
||||
let rx = decoder.next().await.unwrap().unwrap();
|
||||
assert_eq!(rx, data);
|
||||
@ -209,7 +209,7 @@ mod tests {
|
||||
codec.send(data.to_vec().into()).await.unwrap();
|
||||
};
|
||||
|
||||
futures::executor::block_on(future::join(client, server));
|
||||
async_std::task::block_on(future::join(client, server));
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
@ -419,7 +419,7 @@ mod tests {
|
||||
}
|
||||
});
|
||||
|
||||
futures::executor::block_on(async move {
|
||||
async_std::task::block_on(async move {
|
||||
let listen_addr = l_a_rx.await.unwrap();
|
||||
let connec = async_std::net::TcpStream::connect(&listen_addr).await.unwrap();
|
||||
let mut codec = handshake(connec, key2).await.unwrap().0;
|
||||
|
@ -486,7 +486,7 @@ mod tests {
|
||||
.for_each(|_| futures::future::ready(()));
|
||||
|
||||
let client = TcpConfig::new().dial(addr).expect("dialer");
|
||||
futures::executor::block_on(futures::future::join(server, client)).1.unwrap();
|
||||
async_std::task::block_on(futures::future::join(server, client)).1.unwrap();
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
@ -16,7 +16,7 @@ either = "1.5.3"
|
||||
futures = "0.3.1"
|
||||
libp2p-core = { version = "0.13.0", path = "../../core" }
|
||||
log = "0.4.8"
|
||||
quicksink = { git = "https://github.com/paritytech/quicksink.git" }
|
||||
quicksink = "0.1"
|
||||
rustls = "0.16"
|
||||
rw-stream-sink = { version = "0.1.1", path = "../../misc/rw-stream-sink" }
|
||||
soketto = { git = "https://github.com/paritytech/soketto.git", branch = "develop", features = ["deflate"] }
|
||||
|
Reference in New Issue
Block a user