Skip to content

Commit

Permalink
dht: linting
Browse files Browse the repository at this point in the history
  • Loading branch information
jbenet committed Dec 9, 2014
1 parent 72dd371 commit a123773
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
4 changes: 2 additions & 2 deletions routing/dht/dht.go
Original file line number Diff line number Diff line change
@@ -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

Expand Down Expand Up @@ -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 {
Expand Down
2 changes: 2 additions & 0 deletions routing/dht/pb/message.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
4 changes: 3 additions & 1 deletion routing/dht/routing.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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) {

Expand Down

0 comments on commit a123773

Please sign in to comment.