Jelajahi Sumber

net: change private p2p functions to pub(crate)

x 3 tahun lalu
induk
melakukan
3b4103e40b
2 mengubah file dengan 12 tambahan dan 12 penghapusan
  1. 1 1
      src/net/dnet.rs
  2. 11 11
      src/net/p2p.rs

+ 1 - 1
src/net/dnet.rs

@@ -40,7 +40,7 @@ pub struct MessageInfo {
     pub time: NanoTimestamp,
 }
 
-// Needed by the macro
+// Needed by the dnetev!() macro
 pub type SendMessage = MessageInfo;
 pub type RecvMessage = MessageInfo;
 

+ 11 - 11
src/net/p2p.rs

@@ -202,14 +202,6 @@ impl P2p {
         self.stop_subscriber.notify(()).await
     }
 
-    /// Add a channel to the set of connected channels
-    pub async fn store(&self, channel: ChannelPtr) {
-        // TODO: Check the code path for this, and potentially also insert the remote
-        // into the hosts list?
-        self.channels.lock().await.insert(channel.address().clone(), channel.clone());
-        self.channel_subscriber.notify(Ok(channel)).await;
-    }
-
     /// Broadcasts a message concurrently across all active channels.
     pub async fn broadcast<M: Message>(&self, message: &M) {
         self.broadcast_with_exclude(message, &[]).await
@@ -253,18 +245,26 @@ impl P2p {
         self.channels.lock().await.contains_key(addr)
     }
 
+    /// Add a channel to the set of connected channels
+    pub(crate) async fn store(&self, channel: ChannelPtr) {
+        // TODO: Check the code path for this, and potentially also insert the remote
+        // into the hosts list?
+        self.channels.lock().await.insert(channel.address().clone(), channel.clone());
+        self.channel_subscriber.notify(Ok(channel)).await;
+    }
+
     /// Remove a channel from the set of connected channels
-    pub async fn remove(&self, channel: ChannelPtr) {
+    pub(crate) async fn remove(&self, channel: ChannelPtr) {
         self.channels.lock().await.remove(channel.address());
     }
 
     /// Add an address to the list of pending channels.
-    pub async fn add_pending(&self, addr: &Url) -> bool {
+    pub(crate) async fn add_pending(&self, addr: &Url) -> bool {
         self.pending.lock().await.insert(addr.clone())
     }
 
     /// Remove a channel from the list of pending channels.
-    pub async fn remove_pending(&self, addr: &Url) {
+    pub(crate) async fn remove_pending(&self, addr: &Url) {
         self.pending.lock().await.remove(addr);
     }