Skip to content

Commit

Permalink
feat: update torii client
Browse files Browse the repository at this point in the history
  • Loading branch information
Larkooo committed Feb 7, 2024
1 parent 0554a34 commit c1b343f
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 6 deletions.
6 changes: 3 additions & 3 deletions crates/torii/client/src/client/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -101,9 +101,9 @@ impl Client {
})
}

/// Waits for the relay connection to be established.
pub async fn wait_for_connection(&mut self) -> Result<(), Error> {
self.relay_client.command_sender.wait_for_connection().await.map_err(Error::RelayClient)
/// Waits for the relay to be ready and listening for messages.
pub async fn wait_for_relay(&mut self) -> Result<(), Error> {
self.relay_client.command_sender.wait_for_relay().await.map_err(Error::RelayClient)
}

Check warning on line 107 in crates/torii/client/src/client/mod.rs

View check run for this annotation

Codecov / codecov/patch

crates/torii/client/src/client/mod.rs#L105-L107

Added lines #L105 - L107 were not covered by tests

/// Subscribes to a topic.
Expand Down
2 changes: 1 addition & 1 deletion crates/torii/libp2p/src/client/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use std::time::Duration;
use futures::channel::mpsc::{UnboundedReceiver, UnboundedSender};
use futures::channel::oneshot;
use futures::lock::Mutex;
use futures::{select, FutureExt, StreamExt};
use futures::{select, StreamExt};
use libp2p::gossipsub::{self, IdentTopic, MessageId, TopicHash};
use libp2p::swarm::{NetworkBehaviour, Swarm, SwarmEvent};
use libp2p::{identify, identity, ping, Multiaddr, PeerId};
Expand Down
5 changes: 4 additions & 1 deletion crates/torii/libp2p/src/server/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,10 @@ impl Relay {
"Subscribed to topic"
);
}
ServerEvent::Gossipsub(gossipsub::Event::Unsubscribed { peer_id, topic }) => {
ServerEvent::Gossipsub(gossipsub::Event::Unsubscribed {
peer_id,
topic,

Check warning on line 195 in crates/torii/libp2p/src/server/mod.rs

View check run for this annotation

Codecov / codecov/patch

crates/torii/libp2p/src/server/mod.rs#L194-L195

Added lines #L194 - L195 were not covered by tests
}) => {
info!(
target: "torii::relay::server::gossipsub",
peer_id = %peer_id,
Expand Down
2 changes: 1 addition & 1 deletion crates/torii/libp2p/src/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ mod test {
// Make sure the cert hash is correct - corresponding to the cert in the relay server
let mut client = RelayClient::new(
"/ip4/127.0.0.1/udp/9091/webrtc-direct/certhash/\
uEiCAoeHQh49fCHDolECesXO0CPR7fpz0sv0PWVaIahzT4g"
uEiCAoeHQh49fCHDolECesXO0CPR7fpz0sv0PWVaIahzT4g"
.to_string(),
)?;

Expand Down

0 comments on commit c1b343f

Please sign in to comment.