@@ -759,7 +759,8 @@ impl<Types: IpfsTypes> Ipfs<Types> {
759
759
760
760
/// Add a peer to list of nodes to propagate messages to.
761
761
///
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.
763
764
pub async fn pubsub_add_peer ( & self , peer_id : PeerId ) -> Result < ( ) , Error > {
764
765
async move {
765
766
let ( tx, rx) = oneshot_channel :: < ( ) > ( ) ;
@@ -777,7 +778,7 @@ impl<Types: IpfsTypes> Ipfs<Types> {
777
778
778
779
/// Remove a peer from the list of nodes that messages are propagated to.
779
780
///
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.
781
782
pub async fn pubsub_remove_peer ( & self , peer_id : PeerId ) -> Result < ( ) , Error > {
782
783
async move {
783
784
let ( tx, rx) = oneshot_channel :: < ( ) > ( ) ;
@@ -1878,11 +1879,8 @@ mod tests {
1878
1879
#[ tokio:: test]
1879
1880
async fn test_pubsub_send_and_receive ( ) {
1880
1881
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 ( ) ;
1883
1882
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 ( ) ;
1886
1884
1887
1885
let topic = String :: from ( "test_topic" ) ;
1888
1886
alice
0 commit comments