more verbose documentation edit on p2p.rs. summarizes interface utlities

This commit is contained in:
rachel-rose
2021-04-05 09:59:01 +02:00
parent 63c9bf6907
commit 78816ccb61

View File

@@ -18,7 +18,12 @@ pub type ConnectedChannels<T> = Mutex<HashMap<SocketAddr, Arc<T>>>;
/// Atomic pointer to p2p interface.
pub type P2pPtr = Arc<P2p>;
/// Top level peer-to-peer networking interface.
/// Top level peer-to-peer networking interface. Provides all core functionality
/// to interact with the peer-to-peer network. Used to create a network, to
/// start and run it, to broadcast messages across all channels, and to manage
/// the channel store. The channel store is a hashmap of channel address that we
/// can use to add and remove channels or check whether a channel is already is
/// in the store.
pub struct P2p {
pending: PendingChannels,
channels: ConnectedChannels<Channel>,
@@ -137,7 +142,7 @@ impl P2p {
self.channel_subscriber.clone().subscribe().await
}
/// Stop a subscription.
/// Subscribe to a stop signal.
pub async fn subscribe_stop(&self) -> Subscription<NetError> {
self.stop_subscriber.clone().subscribe().await
}