Skip to content

Commit

Permalink
chore: clippy and fmt
Browse files Browse the repository at this point in the history
  • Loading branch information
Larkooo committed Jan 24, 2024
1 parent 67e43b0 commit 67c466c
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 12 deletions.
6 changes: 3 additions & 3 deletions crates/torii/libp2p/src/client/mod.rs
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
use std::time::Duration;

use futures::channel::mpsc::{Receiver, Sender};
use futures::StreamExt;
use futures::{select, SinkExt};
use futures::{select, SinkExt, StreamExt};
use libp2p::gossipsub::{self, IdentTopic, MessageId};
use libp2p::swarm::{NetworkBehaviour, Swarm, SwarmEvent};
use libp2p::{identify, identity, ping, Multiaddr, PeerId};
#[cfg(not(target_arch = "wasm32"))]
use libp2p::{noise, tcp, yamux};
use std::time::Duration;
use tracing::info;

pub mod events;
Expand Down
4 changes: 1 addition & 3 deletions crates/torii/libp2p/src/server/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -94,9 +94,7 @@ impl Libp2pRelay {
.unwrap(),
}
})?
.with_swarm_config(|cfg| {
cfg.with_idle_connection_timeout(Duration::from_secs(60))
})
.with_swarm_config(|cfg| cfg.with_idle_connection_timeout(Duration::from_secs(60)))
.build();

// TCP
Expand Down
16 changes: 10 additions & 6 deletions crates/torii/libp2p/src/tests.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
#[cfg(test)]
mod test {
use crate::client::Command;
use crate::client::Libp2pClient;
use crate::types::ClientMessage;
use futures::{SinkExt, StreamExt};
use std::error::Error;

use futures::{SinkExt, StreamExt};

use crate::client::{Command, Libp2pClient};
use crate::types::ClientMessage;

#[cfg(target_arch = "wasm32")]
wasm_bindgen_test::wasm_bindgen_test_configure!(run_in_browser);
#[cfg(target_arch = "wasm32")]
Expand All @@ -15,11 +16,13 @@ mod test {
#[cfg(not(target_arch = "wasm32"))]
#[tokio::test]
async fn test_client_messaging() -> Result<(), Box<dyn Error>> {
use crate::server::Libp2pRelay;
use std::time::Duration;

use tokio::time::sleep;
use tokio::{self, select};

use crate::server::Libp2pRelay;

let _ = tracing_subscriber::fmt().with_env_filter("torii_libp2p=debug").try_init();
// Initialize the relay server
let mut relay_server: Libp2pRelay = Libp2pRelay::new(9090, 9091, None, None)?;
Expand Down Expand Up @@ -74,7 +77,8 @@ mod test {
// Initialize the first client (listener)
// Make sure the cert hash is correct - corresponding to the cert in the relay server
let mut client = Libp2pClient::new(
"/ip4/127.0.0.1/udp/9091/webrtc-direct/certhash/uEiBDKAUMioKpVK2CLQjtOL9eLPmaJkTcPPbBMtau7XaPGA"
"/ip4/127.0.0.1/udp/9091/webrtc-direct/certhash/\
uEiBDKAUMioKpVK2CLQjtOL9eLPmaJkTcPPbBMtau7XaPGA"
.to_string(),
)?;

Expand Down

0 comments on commit 67c466c

Please sign in to comment.