Skip to content

Commit

Permalink
fix addrsSoFar comparison (#1046)
Browse files Browse the repository at this point in the history
  • Loading branch information
MarcoPolo authored Feb 21, 2025
1 parent bdc3815 commit 997f33e
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions fullrt/dht.go
Original file line number Diff line number Diff line change
Expand Up @@ -1442,7 +1442,7 @@ func (dht *FullRT) FindPeer(ctx context.Context, id peer.ID) (pi peer.AddrInfo,
wg.Add(1)
go func() {
defer wg.Done()
addrsSoFar := make(map[multiaddr.Multiaddr]struct{})
addrsSoFar := make(map[string]struct{})
for {
select {
case ai, ok := <-addrsCh:
Expand All @@ -1451,10 +1451,10 @@ func (dht *FullRT) FindPeer(ctx context.Context, id peer.ID) (pi peer.AddrInfo,
}

for _, a := range ai.Addrs {
_, found := addrsSoFar[a]
_, found := addrsSoFar[string(a.Bytes())]
if !found {
newAddrs = append(newAddrs, a)
addrsSoFar[a] = struct{}{}
addrsSoFar[string(a.Bytes())] = struct{}{}
}
}
case <-ctx.Done():
Expand Down

0 comments on commit 997f33e

Please sign in to comment.