Skip to content

Commit 1c471ed

Browse files
committed
enable last check
1 parent 80e22b2 commit 1c471ed

File tree

1 file changed

+20
-21
lines changed

1 file changed

+20
-21
lines changed

src/peer_channels.rs

Lines changed: 20 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -143,10 +143,8 @@ impl Iroh {
143143
if self.iroh_channels.read().await.get(&topic).is_some() {
144144
self.router.endpoint().add_node_addr(peer.clone())?;
145145
self.gossip.subscribe(topic, vec![peer.node_id])?;
146-
Ok(())
147-
} else {
148-
anyhow::bail!("can not read iroh channels");
149146
}
147+
Ok(())
150148
}
151149

152150
/// Send realtime data to the gossip swarm.
@@ -560,17 +558,15 @@ async fn subscribe_loop(
560558

561559
#[cfg(test)]
562560
mod tests {
563-
use std::time::Duration;
564-
565-
use tokio::time::timeout;
566-
567561
use super::*;
568562
use crate::{
569563
EventType,
570564
chat::{self, ChatId, ProtectionStatus, add_contact_to_chat, resend_msgs, send_msg},
571565
message::{Message, Viewtype},
572566
test_utils::{TestContext, TestContextManager},
573567
};
568+
use std::time::Duration;
569+
use tokio::time::timeout;
574570

575571
#[tokio::test(flavor = "multi_thread", worker_threads = 2)]
576572
async fn test_can_communicate() {
@@ -1003,20 +999,23 @@ mod tests {
1003999
.await
10041000
.unwrap();
10051001

1006-
eprintln!("Waiting for ephemeral message");
1007-
// loop {
1008-
// let event = fiona.evtracker.recv().await.unwrap();
1009-
// if let EventType::WebxdcRealtimeData { data, .. } = event.typ {
1010-
// if data == b"alice -> bob & fiona" {
1011-
// break;
1012-
// } else {
1013-
// panic!(
1014-
// "Unexpected status update: {}",
1015-
// String::from_utf8_lossy(&data)
1016-
// );
1017-
// }
1018-
// }
1019-
// }
1002+
timeout(Duration::from_secs(2), async {
1003+
loop {
1004+
let event = fiona.evtracker.recv().await.unwrap();
1005+
if let EventType::WebxdcRealtimeData { data, .. } = event.typ {
1006+
if data == b"alice -> bob & fiona" {
1007+
break;
1008+
} else {
1009+
panic!(
1010+
"Unexpected status update: {}",
1011+
String::from_utf8_lossy(&data)
1012+
);
1013+
}
1014+
}
1015+
}
1016+
})
1017+
.await
1018+
.unwrap();
10201019
}
10211020

10221021
async fn connect_alice_bob(

0 commit comments

Comments
 (0)