diff --git a/crates/torii/libp2p/src/server/mod.rs b/crates/torii/libp2p/src/server/mod.rs index 5c4a3f990c..ce36df9e6c 100644 --- a/crates/torii/libp2p/src/server/mod.rs +++ b/crates/torii/libp2p/src/server/mod.rs @@ -6,13 +6,11 @@ use std::time::Duration; use futures::StreamExt; use libp2p::core::multiaddr::Protocol; +use libp2p::core::muxing::StreamMuxerBox; use libp2p::core::Multiaddr; use libp2p::gossipsub::{self, IdentTopic}; use libp2p::swarm::{NetworkBehaviour, SwarmEvent}; -use libp2p::{ - core::muxing::StreamMuxerBox, identify, identity, noise, ping, relay, tcp, yamux, - Swarm, Transport, -}; +use libp2p::{identify, identity, noise, ping, relay, tcp, yamux, Swarm, Transport}; use libp2p_webrtc as webrtc; use rand::thread_rng; use tracing::info; @@ -51,7 +49,8 @@ impl Libp2pRelay { webrtc::tokio::Certificate::generate(&mut thread_rng())?, ) .map(|(peer_id, conn), _| (peer_id, StreamMuxerBox::new(conn)))) - }).expect("Failed to create WebRTC transport") + }) + .expect("Failed to create WebRTC transport") .with_behaviour(|key| { let message_id_fn = |message: &gossipsub::Message| { let mut s = DefaultHasher::new(); @@ -119,7 +118,11 @@ impl Libp2pRelay { let message: ClientMessage = serde_json::from_slice(&message.data) .expect("Failed to deserialize message"); - info!("Received message {:?} from peer {:?} with topic {:?} and data {:?}", message_id, peer_id, message.topic, message.data); + info!( + "Received message {:?} from peer {:?} with topic {:?} and data \ + {:?}", + message_id, peer_id, message.topic, message.data + ); // forward message to room let server_message = diff --git a/crates/torii/libp2p/src/tests.rs b/crates/torii/libp2p/src/tests.rs index ce5eac487f..67b27b75fe 100644 --- a/crates/torii/libp2p/src/tests.rs +++ b/crates/torii/libp2p/src/tests.rs @@ -14,9 +14,7 @@ mod test { // This tests subscribing to a topic and receiving a message #[tokio::test] async fn test_client_messaging() -> Result<(), Box> { - let _ = tracing_subscriber::fmt() - .with_env_filter("torii_libp2p=debug") - .try_init(); + let _ = tracing_subscriber::fmt().with_env_filter("torii_libp2p=debug").try_init(); // Initialize the relay server let mut relay_server: Libp2pRelay = Libp2pRelay::new(1010, 2020)?;