Skip to content

Commit

Permalink
comments formatting and typos (#1019)
Browse files Browse the repository at this point in the history
  • Loading branch information
guillaumemichel authored Feb 6, 2025
1 parent 4a7d31d commit 5065a50
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 16 deletions.
12 changes: 5 additions & 7 deletions amino/defaults.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import (
)

const (
// ProtocolPrefix is the base prefix for Amono DHT protocols.
// ProtocolPrefix is the base prefix for Amino DHT protocols.
ProtocolPrefix protocol.ID = "/ipfs"

// ProtocolID is the latest protocol identifier for the Amino DHT.
Expand Down Expand Up @@ -49,9 +49,7 @@ const (
DefaultProviderAddrTTL = 24 * time.Hour
)

var (
// Protocols is a slice containing all supported protocol IDs for Amino DHT.
// Currently, it only includes the main ProtocolID, but it's defined as a slice
// to allow for potential future protocol versions or variants.
Protocols = []protocol.ID{ProtocolID}
)
// Protocols is a slice containing all supported protocol IDs for Amino DHT.
// Currently, it only includes the main ProtocolID, but it's defined as a slice
// to allow for potential future protocol versions or variants.
var Protocols = []protocol.ID{ProtocolID}
4 changes: 2 additions & 2 deletions dht.go
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,7 @@ func makeDHT(h host.Host, cfg dhtcfg.Config) (*IpfsDHT, error) {
}

// construct routing table
// use twice the theoritical usefulness threhold to keep older peers around longer
// use twice the theoretical usefulness threshold to keep older peers around longer
rt, err := makeRoutingTable(dht, cfg, 2*maxLastSuccessfulOutboundThreshold)
if err != nil {
return nil, fmt.Errorf("failed to construct routing table,err=%s", err)
Expand Down Expand Up @@ -720,7 +720,7 @@ func (dht *IpfsDHT) validPeerFound(p peer.ID) {
}
}

// peerStoppedDHT signals the routing table that a peer is unable to responsd to DHT queries anymore.
// peerStoppedDHT signals the routing table that a peer is unable to respond to DHT queries anymore.
func (dht *IpfsDHT) peerStoppedDHT(p peer.ID) {
logger.Debugw("peer stopped dht", "peer", p)
// A peer that does not support the DHT protocol is dead for us.
Expand Down
10 changes: 6 additions & 4 deletions dual/dual.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,12 @@ import (
"github.com/hashicorp/go-multierror"
)

const tracer = tracing.Tracer("go-libp2p-kad-dht/dual")
const dualName = "Dual"
const (
tracer = tracing.Tracer("go-libp2p-kad-dht/dual")
dualName = "Dual"
)

// DHT implements the routing interface to provide two concrete DHT implementationts for use
// DHT implements the routing interface to provide two concrete DHT implementations for use
// in IPFS that are used to support both global network users and disjoint LAN usecases.
type DHT struct {
WAN *dht.IpfsDHT
Expand Down Expand Up @@ -99,7 +101,7 @@ func DHTOption(opts ...dht.Option) Option {
// IpfsDHT internal constructions, modulo additional options used by the Dual DHT to enforce
// the LAN-vs-WAN distinction.
// Note: query or routing table functional options provided as arguments to this function
// will be overriden by this constructor.
// will be overridden by this constructor.
func New(ctx context.Context, h host.Host, options ...Option) (*DHT, error) {
var cfg config
err := cfg.apply(
Expand Down
5 changes: 3 additions & 2 deletions handlers.go
Original file line number Diff line number Diff line change
Expand Up @@ -363,8 +363,9 @@ func (dht *IpfsDHT) handleAddProvider(ctx context.Context, p peer.ID, pmes *pb.M
continue
}

// We run the addrs filter after checking for the length,
// this allows transient nodes with varying /p2p-circuit addresses to still have their anouncement go through.
// We run the addrs filter after checking for the length, this allows
// transient nodes with varying /p2p-circuit addresses to still have their
// announcement go through.
addrs := dht.filterAddrs(pi.Addrs)
dht.providerStore.AddProvider(ctx, key, peer.AddrInfo{ID: pi.ID, Addrs: addrs})
}
Expand Down
2 changes: 1 addition & 1 deletion rt_diversity_filter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ func TestRTPeerDiversityFilter(t *testing.T) {
require.True(t, r.Allow(g2))
r.Increment(g2)

// and then it dosen't work again
// and then it doesn't work again
require.False(t, r.Allow(g2))
}

Expand Down

0 comments on commit 5065a50

Please sign in to comment.