@@ -12,15 +12,17 @@ use libp2p_identity::Keypair;
12
12
use std:: time:: Duration ;
13
13
use std:: time:: Instant ;
14
14
15
+ use super :: * ;
15
16
use crate :: utils:: AvailableNodes ;
16
17
17
- use super :: { DriaBehaviour , DriaBehaviourEvent , P2P_KADEMLIA_PROTOCOL , P2P_PROTOCOL_STRING } ;
18
-
19
- /// Underlying libp2p client.
18
+ /// P2P client, exposes a simple interface to handle P2P communication.
20
19
pub struct P2PClient {
21
20
/// `Swarm` instance, everything is accesses through this one.
22
21
swarm : Swarm < DriaBehaviour > ,
23
- /// Peer count for (All, Mesh).
22
+ /// Peer count for All and Mesh peers.
23
+ ///
24
+ /// Mesh usually contains much fewer peers than All, as they are the ones
25
+ /// used for actual gossipping.
24
26
peer_count : ( usize , usize ) ,
25
27
/// Last time the peer count was refreshed.
26
28
peer_last_refreshed : Instant ,
@@ -253,7 +255,7 @@ impl P2PClient {
253
255
if let Some ( kad_protocol) = info
254
256
. protocols
255
257
. iter ( )
256
- . find ( |p| p. to_string ( ) . starts_with ( P2P_KADEMLIA_PREFIX ! ( ) ) )
258
+ . find ( |p| p. to_string ( ) . starts_with ( P2P_KADEMLIA_PREFIX ) )
257
259
{
258
260
// if it matches our protocol, add it to the Kademlia routing table
259
261
if * kad_protocol == P2P_KADEMLIA_PROTOCOL {
0 commit comments