@@ -143,10 +143,8 @@ impl Iroh {
143
143
if self . iroh_channels . read ( ) . await . get ( & topic) . is_some ( ) {
144
144
self . router . endpoint ( ) . add_node_addr ( peer. clone ( ) ) ?;
145
145
self . gossip . subscribe ( topic, vec ! [ peer. node_id] ) ?;
146
- Ok ( ( ) )
147
- } else {
148
- anyhow:: bail!( "can not read iroh channels" ) ;
149
146
}
147
+ Ok ( ( ) )
150
148
}
151
149
152
150
/// Send realtime data to the gossip swarm.
@@ -560,17 +558,15 @@ async fn subscribe_loop(
560
558
561
559
#[ cfg( test) ]
562
560
mod tests {
563
- use std:: time:: Duration ;
564
-
565
- use tokio:: time:: timeout;
566
-
567
561
use super :: * ;
568
562
use crate :: {
569
563
EventType ,
570
564
chat:: { self , ChatId , ProtectionStatus , add_contact_to_chat, resend_msgs, send_msg} ,
571
565
message:: { Message , Viewtype } ,
572
566
test_utils:: { TestContext , TestContextManager } ,
573
567
} ;
568
+ use std:: time:: Duration ;
569
+ use tokio:: time:: timeout;
574
570
575
571
#[ tokio:: test( flavor = "multi_thread" , worker_threads = 2 ) ]
576
572
async fn test_can_communicate ( ) {
@@ -1003,20 +999,23 @@ mod tests {
1003
999
. await
1004
1000
. unwrap ( ) ;
1005
1001
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 ( ) ;
1020
1019
}
1021
1020
1022
1021
async fn connect_alice_bob (
0 commit comments