1
0
mirror of https://github.com/ipfs/kubo.git synced 2025-09-10 09:52:20 +08:00

dht: linting

This commit is contained in:
Juan Batiz-Benet
2014-11-20 10:46:19 -08:00
parent 72dd371809
commit a1237733c2
3 changed files with 7 additions and 3 deletions

View File

@ -1,4 +1,4 @@
// package dht implements a distributed hash table that satisfies the ipfs routing
// Package dht implements a distributed hash table that satisfies the ipfs routing
// interface. This DHT is modeled after kademlia with Coral and S/Kademlia modifications.
package dht
@ -583,7 +583,7 @@ func (dht *IpfsDHT) Bootstrap(ctx context.Context) {
rand.Read(id)
p, err := dht.FindPeer(ctx, peer.ID(id))
if err != nil {
log.Error("Bootstrap peer error: %s", err)
log.Errorf("Bootstrap peer error: %s", err)
}
err = dht.dialer.DialPeer(ctx, p)
if err != nil {

View File

@ -31,6 +31,8 @@ func peerToPBPeer(p peer.Peer) *Message_Peer {
return pbp
}
// PeersToPBPeers converts a slice of Peers into a slice of *Message_Peers,
// ready to go out on the wire.
func PeersToPBPeers(peers []peer.Peer) []*Message_Peer {
pbpeers := make([]*Message_Peer, len(peers))
for i, p := range peers {

View File

@ -125,6 +125,9 @@ func (dht *IpfsDHT) Provide(ctx context.Context, key u.Key) error {
return nil
}
// FindProvidersAsync is the same thing as FindProviders, but returns a channel.
// Peers will be returned on the channel as soon as they are found, even before
// the search query completes.
func (dht *IpfsDHT) FindProvidersAsync(ctx context.Context, key u.Key, count int) <-chan peer.Peer {
log.Event(ctx, "findProviders", &key)
peerOut := make(chan peer.Peer, count)
@ -199,7 +202,6 @@ func (dht *IpfsDHT) addPeerListAsync(ctx context.Context, k u.Key, peers []*pb.M
wg.Wait()
}
// Find specific Peer
// FindPeer searches for a peer with given ID.
func (dht *IpfsDHT) FindPeer(ctx context.Context, id peer.ID) (peer.Peer, error) {