|
|
@@ -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
|
|
|
}
|