From 39dbaec3a0e6fe27134bb066c3f87eb80b1df9fb Mon Sep 17 00:00:00 2001 From: Alex Chen Date: Mon, 21 Jun 2021 10:33:17 +0800 Subject: [PATCH 1/3] [p2p] Fix context leak in resolveMultiAddr --- p2p/types/peerAddr.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/p2p/types/peerAddr.go b/p2p/types/peerAddr.go index f3e0c7e940..724a372692 100644 --- a/p2p/types/peerAddr.go +++ b/p2p/types/peerAddr.go @@ -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 From f0965abad7470522a9e57f027526bc9cd6023f25 Mon Sep 17 00:00:00 2001 From: Alex Chen Date: Mon, 21 Jun 2021 11:46:56 +0800 Subject: [PATCH 2/3] [p2p] upgrade go-libp2p-kad-dht to v0.12.1 --- go.mod | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/go.mod b/go.mod index 3c0ec87392..86c95359fc 100644 --- a/go.mod +++ b/go.mod @@ -34,7 +34,7 @@ require ( 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-kad-dht v0.12.1 github.com/libp2p/go-libp2p-pubsub v0.4.0 github.com/multiformats/go-multiaddr v0.3.1 github.com/multiformats/go-multiaddr-dns v0.3.1 From f14ca9c45f386f52494fda80bd941ea3c7c2bfa0 Mon Sep 17 00:00:00 2001 From: Alex Chen Date: Tue, 22 Jun 2021 15:13:16 +0800 Subject: [PATCH 3/3] [p2p] Upgrade entire libp2p stack --- go.mod | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/go.mod b/go.mod index 86c95359fc..c12af6ca61 100644 --- a/go.mod +++ b/go.mod @@ -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.12.1 - github.com/libp2p/go-libp2p-pubsub v0.4.0 + 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