mirror of
https://github.com/vacp2p/nim-libp2p.git
synced 2025-03-01 16:40:32 +00:00
docs: make comments clearer
This commit is contained in:
parent
157279b0d9
commit
a6c5343998
@ -510,8 +510,8 @@ proc advertise*(
|
|||||||
) {.async.} =
|
) {.async.} =
|
||||||
## The advertise async procedure sends advertisements for a namespace
|
## The advertise async procedure sends advertisements for a namespace
|
||||||
## to a sequence of peers. It encodes and sends a signed peer record
|
## to a sequence of peers. It encodes and sends a signed peer record
|
||||||
## along with a time-to-live value, validating the inputs. Advertisements
|
## along with a time-to-live value. Advertisements are sent
|
||||||
## are sent concurrently to all specified peers.
|
## concurrently to all specified peers.
|
||||||
##
|
##
|
||||||
if ns.len notin 1 .. 255:
|
if ns.len notin 1 .. 255:
|
||||||
raise newException(RendezVousError, "Invalid namespace")
|
raise newException(RendezVousError, "Invalid namespace")
|
||||||
@ -542,8 +542,7 @@ proc advertise*(
|
|||||||
|
|
||||||
proc requestLocally*(rdv: RendezVous, ns: string): seq[PeerRecord] =
|
proc requestLocally*(rdv: RendezVous, ns: string): seq[PeerRecord] =
|
||||||
## This procedure returns all the peers already registered on the
|
## This procedure returns all the peers already registered on the
|
||||||
## given namespace. This function is synchronous, no remote
|
## given namespace. This function is synchronous
|
||||||
## request is done.
|
|
||||||
##
|
##
|
||||||
let
|
let
|
||||||
nsSalted = ns & rdv.salt
|
nsSalted = ns & rdv.salt
|
||||||
@ -561,10 +560,9 @@ proc requestLocally*(rdv: RendezVous, ns: string): seq[PeerRecord] =
|
|||||||
proc request*(
|
proc request*(
|
||||||
rdv: RendezVous, ns: string, l: int = DiscoverLimit.int, peers: seq[PeerId]
|
rdv: RendezVous, ns: string, l: int = DiscoverLimit.int, peers: seq[PeerId]
|
||||||
): Future[seq[PeerRecord]] {.async.} =
|
): Future[seq[PeerRecord]] {.async.} =
|
||||||
## This async procedure request discovers peer records for a given namespace
|
## This async procedure request discovers and returns peers for
|
||||||
## by dialing peers, sending requests, and processing responses. It handles
|
## a given namespace by sending requests and processing responses.
|
||||||
## response validation, cookie updates, and limits the number of peer records
|
## It limits the number of peer records retrieved based on the provided limit.
|
||||||
## retrieved based on the provided limit.
|
|
||||||
##
|
##
|
||||||
var
|
var
|
||||||
s: Table[PeerId, (PeerRecord, Register)]
|
s: Table[PeerId, (PeerRecord, Register)]
|
||||||
@ -658,9 +656,8 @@ proc unsubscribeLocally*(rdv: RendezVous, ns: string) =
|
|||||||
|
|
||||||
proc unsubscribe*(rdv: RendezVous, ns: string, peerIds: seq[PeerId]) {.async.} =
|
proc unsubscribe*(rdv: RendezVous, ns: string, peerIds: seq[PeerId]) {.async.} =
|
||||||
## The async unsubscribe procedure removes peers from a namespace by
|
## The async unsubscribe procedure removes peers from a namespace by
|
||||||
## sending an "Unregister" message to each peer. It validates the
|
## sending an "Unregister" message to each connected peer. The operation
|
||||||
## namespace, dials the peers. The operation is bounded by a timeout
|
## is bounded by a timeout for unsubscribing from all peers.
|
||||||
## for unsubscribing from all peers.
|
|
||||||
##
|
##
|
||||||
if ns.len notin 1 .. 255:
|
if ns.len notin 1 .. 255:
|
||||||
raise newException(RendezVousError, "Invalid namespace")
|
raise newException(RendezVousError, "Invalid namespace")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user