@@ -759,7 +759,8 @@ impl<Types: IpfsTypes> Ipfs<Types> {
759759
760760 /// Add a peer to list of nodes to propagate messages to.
761761 ///
762- /// Unless a peer is added to the list in this way it will not receive any pubsub messages from this node.
762+ /// A peer will not receive any pubsub messages from this node until it is added using this function,
763+ /// unless it has added this node in the same way.
763764 pub async fn pubsub_add_peer ( & self , peer_id : PeerId ) -> Result < ( ) , Error > {
764765 async move {
765766 let ( tx, rx) = oneshot_channel :: < ( ) > ( ) ;
@@ -777,7 +778,7 @@ impl<Types: IpfsTypes> Ipfs<Types> {
777778
778779 /// Remove a peer from the list of nodes that messages are propagated to.
779780 ///
780- /// This will not stop messages being sent to the specified peers for subscribed topics which have already been communicated.
781+ /// Calling this function will not stop messages being sent to the specified peers for subscribed topics which have already been communicated.
781782 pub async fn pubsub_remove_peer ( & self , peer_id : PeerId ) -> Result < ( ) , Error > {
782783 async move {
783784 let ( tx, rx) = oneshot_channel :: < ( ) > ( ) ;
@@ -1878,11 +1879,8 @@ mod tests {
18781879 #[ tokio:: test]
18791880 async fn test_pubsub_send_and_receive ( ) {
18801881 let alice = Node :: new ( "alice" ) . await ;
1881- let alice_addr: Multiaddr = "/ip4/127.0.0.1/tcp/10001" . parse ( ) . unwrap ( ) ;
1882- alice. add_listening_address ( alice_addr) . await . unwrap ( ) ;
18831882 let bob = Node :: new ( "bob" ) . await ;
1884- let bob_addr: Multiaddr = "/ip4/127.0.0.1/tcp/10002" . parse ( ) . unwrap ( ) ;
1885- bob. add_listening_address ( bob_addr. clone ( ) ) . await . unwrap ( ) ;
1883+ let bob_addr = bob. addrs_local ( ) . await . unwrap ( ) [ 0 ] . clone ( ) ;
18861884
18871885 let topic = String :: from ( "test_topic" ) ;
18881886 alice
0 commit comments