[p2p] Try to fix P2P memory issue (#3795)

* [p2p] Fix context leak in resolveMultiAddr

* [p2p] upgrade go-libp2p-kad-dht to v0.12.1

* [p2p] Upgrade entire libp2p stack
pull/3804/head
MathxH Chen 3 years ago committed by GitHub
parent 96d525a36f
commit b8cd520927
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 6
      go.mod
  2. 3
      p2p/types/peerAddr.go

@ -30,12 +30,12 @@ require (
github.com/hashicorp/golang-lru v0.5.4
github.com/ipfs/go-ds-badger v0.2.4
github.com/json-iterator/go v1.1.10
github.com/libp2p/go-libp2p v0.14.0
github.com/libp2p/go-libp2p v0.14.2
github.com/libp2p/go-libp2p-core v0.8.5
github.com/libp2p/go-libp2p-crypto v0.1.0
github.com/libp2p/go-libp2p-discovery v0.5.0
github.com/libp2p/go-libp2p-kad-dht v0.11.1
github.com/libp2p/go-libp2p-pubsub v0.4.0
github.com/libp2p/go-libp2p-kad-dht v0.12.1
github.com/libp2p/go-libp2p-pubsub v0.4.1
github.com/multiformats/go-multiaddr v0.3.1
github.com/multiformats/go-multiaddr-dns v0.3.1
github.com/natefinch/lumberjack v2.0.0+incompatible

@ -86,7 +86,8 @@ func resolveMultiAddrString(addrStr string) ([]libp2p_peer.AddrInfo, error) {
func resolveMultiAddr(raw ma.Multiaddr) ([]ma.Multiaddr, error) {
if madns.Matches(raw) {
ctx, _ := context.WithTimeout(context.Background(), 10*time.Second)
ctx, cancel := context.WithTimeout(context.Background(), 10*time.Second)
defer cancel()
mas, err := madns.Resolve(ctx, raw)
if err != nil {
return nil, err

Loading…
Cancel
Save