From bda1420f1f5bfb5520557393b6e0e45ecd700ef1 Mon Sep 17 00:00:00 2001 From: Elena Frank Date: Wed, 4 Jan 2023 18:10:12 +0100 Subject: [PATCH] fix(examples): subscribe to topic in chat-tokio (#3296) With #3097, subscribing to the floodsub topic in `examples/chat-tokio.rs` was removed. I assume this was unintentional (cc @umgefahren), so this PR adds it back. --- examples/chat-tokio.rs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/examples/chat-tokio.rs b/examples/chat-tokio.rs index 2d644b0f360..e2f88201fb8 100644 --- a/examples/chat-tokio.rs +++ b/examples/chat-tokio.rs @@ -92,10 +92,13 @@ async fn main() -> Result<(), Box> { // Create a Swarm to manage peers and events. let mdns_behaviour = mdns::Behaviour::new(Default::default(), peer_id)?; - let behaviour = MyBehaviour { + let mut behaviour = MyBehaviour { floodsub: Floodsub::new(peer_id), mdns: mdns_behaviour, }; + + behaviour.floodsub.subscribe(floodsub_topic.clone()); + let mut swarm = libp2p_swarm::Swarm::with_tokio_executor(transport, behaviour, peer_id); // Reach out to another node if specified