diff --git a/VERSION b/VERSION index e99e78f80..b50886812 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -0.175.1 \ No newline at end of file +0.175.2 \ No newline at end of file diff --git a/go.mod b/go.mod index d2ffe4a2c..e1619014d 100644 --- a/go.mod +++ b/go.mod @@ -89,7 +89,7 @@ require ( github.com/mutecomm/go-sqlcipher/v4 v4.4.2 github.com/schollz/peerdiscovery v1.7.0 github.com/siphiuel/lc-proxy-wrapper v0.0.0-20230516150924-246507cee8c7 - github.com/waku-org/go-waku v0.8.1-0.20240130093642-77ea359ef873 + github.com/waku-org/go-waku v0.8.1-0.20240220211751-9bb2c8e39680 github.com/wk8/go-ordered-map/v2 v2.1.7 github.com/yeqown/go-qrcode/v2 v2.2.1 github.com/yeqown/go-qrcode/writer/standard v1.2.1 diff --git a/go.sum b/go.sum index 92c8065c5..abc8a4e71 100644 --- a/go.sum +++ b/go.sum @@ -2101,8 +2101,8 @@ github.com/waku-org/go-discover v0.0.0-20240129014929-85f2c00b96a3 h1:Kk0KYXZE/u github.com/waku-org/go-discover v0.0.0-20240129014929-85f2c00b96a3/go.mod h1:eBHgM6T4EG0RZzxpxKy+rGz/6Dw2Nd8DWxS0lm9ESDw= github.com/waku-org/go-libp2p-rendezvous v0.0.0-20230628220917-7b4e5ae4c0e7 h1:0e1h+p84yBp0IN7AqgbZlV7lgFBjm214lgSOE7CeJmE= github.com/waku-org/go-libp2p-rendezvous v0.0.0-20230628220917-7b4e5ae4c0e7/go.mod h1:pFvOZ9YTFsW0o5zJW7a0B5tr1owAijRWJctXJ2toL04= -github.com/waku-org/go-waku v0.8.1-0.20240130093642-77ea359ef873 h1:pnUvFENjM/h7HVF8VsNWTmOXx/rYs62P7H2EFjAnwVw= -github.com/waku-org/go-waku v0.8.1-0.20240130093642-77ea359ef873/go.mod h1:RjTvkTrIwpoT1cM9HeQqwa2Q7t7WOkb3hpuB/zuZ6SM= +github.com/waku-org/go-waku v0.8.1-0.20240220211751-9bb2c8e39680 h1:WGPMcGDmW7q9ZPoD5V53T1ak36/qo1rYLE9bv4g5BVY= +github.com/waku-org/go-waku v0.8.1-0.20240220211751-9bb2c8e39680/go.mod h1:RjTvkTrIwpoT1cM9HeQqwa2Q7t7WOkb3hpuB/zuZ6SM= github.com/waku-org/go-zerokit-rln v0.1.14-0.20240102145250-fa738c0bdf59 h1:jisj+OCI6QydLtFq3Pyhu49wl9ytPN7oAHjMfepHDrA= github.com/waku-org/go-zerokit-rln v0.1.14-0.20240102145250-fa738c0bdf59/go.mod h1:1PdBdPzyTaKt3VnpAHk3zj+r9dXPFOr3IHZP9nFle6E= github.com/waku-org/go-zerokit-rln-apple v0.0.0-20230916172309-ee0ee61dde2b h1:KgZVhsLkxsj5gb/FfndSCQu6VYwALrCOgYI3poR95yE= diff --git a/vendor/github.com/waku-org/go-waku/waku/v2/discv5/discover.go b/vendor/github.com/waku-org/go-waku/waku/v2/discv5/discover.go index e88721eb9..dd9a462ad 100644 --- a/vendor/github.com/waku-org/go-waku/waku/v2/discv5/discover.go +++ b/vendor/github.com/waku-org/go-waku/waku/v2/discv5/discover.go @@ -317,24 +317,7 @@ func (d *DiscoveryV5) Iterate(ctx context.Context, iterator enode.Iterator, onNo defer iterator.Close() peerCnt := 0 - for { - - if !delayedHasNext(ctx, iterator) { - return - } - - peerCnt++ - if peerCnt == bucketSize { // Delay every bucketSize peers discovered - peerCnt = 0 - t := time.NewTimer(delayBetweenDiscoveredPeerCnt) - select { - case <-ctx.Done(): - return - case <-t.C: - t.Stop() - } - } - + for DelayedHasNext(ctx, iterator, &peerCnt) { _, addresses, err := wenr.Multiaddress(iterator.Node()) if err != nil { d.metrics.RecordError(peerInfoFailure) @@ -364,7 +347,7 @@ func (d *DiscoveryV5) Iterate(ctx context.Context, iterator enode.Iterator, onNo } } -func delayedHasNext(ctx context.Context, iterator enode.Iterator) bool { +func DelayedHasNext(ctx context.Context, iterator enode.Iterator, peerCnt *int) bool { // Delay if .Next() is too fast start := time.Now() hasNext := iterator.Next() @@ -383,6 +366,18 @@ func delayedHasNext(ctx context.Context, iterator enode.Iterator) bool { } } + *peerCnt++ + if *peerCnt == bucketSize { // Delay every bucketSize peers discovered + *peerCnt = 0 + t := time.NewTimer(delayBetweenDiscoveredPeerCnt) + select { + case <-ctx.Done(): + return false + case <-t.C: + t.Stop() + } + } + return true } diff --git a/vendor/github.com/waku-org/go-waku/waku/v2/protocol/peer_exchange/protocol.go b/vendor/github.com/waku-org/go-waku/waku/v2/protocol/peer_exchange/protocol.go index 374cde3aa..3f4a15739 100644 --- a/vendor/github.com/waku-org/go-waku/waku/v2/protocol/peer_exchange/protocol.go +++ b/vendor/github.com/waku-org/go-waku/waku/v2/protocol/peer_exchange/protocol.go @@ -144,7 +144,8 @@ func (wakuPX *WakuPeerExchange) iterate(ctx context.Context) error { // Closing iterator defer iterator.Close() - for iterator.Next() { + peerCnt := 0 + for discv5.DelayedHasNext(ctx, iterator, &peerCnt) { _, addresses, err := enr.Multiaddress(iterator.Node()) if err != nil { wakuPX.log.Error("extracting multiaddrs from enr", zap.Error(err)) @@ -183,12 +184,15 @@ func (wakuPX *WakuPeerExchange) runPeerExchangeDiscv5Loop(ctx context.Context) { err := wakuPX.iterate(ctx) if err != nil { wakuPX.log.Debug("iterating peer exchange", zap.Error(err)) - time.Sleep(2 * time.Second) } + + t := time.NewTimer(5 * time.Second) select { + case <-t.C: + t.Stop() case <-ctx.Done(): + t.Stop() return - default: } } } diff --git a/vendor/modules.txt b/vendor/modules.txt index b8f586112..147327f3d 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -1020,7 +1020,7 @@ github.com/waku-org/go-discover/discover/v5wire github.com/waku-org/go-libp2p-rendezvous github.com/waku-org/go-libp2p-rendezvous/db github.com/waku-org/go-libp2p-rendezvous/pb -# github.com/waku-org/go-waku v0.8.1-0.20240130093642-77ea359ef873 +# github.com/waku-org/go-waku v0.8.1-0.20240220211751-9bb2c8e39680 ## explicit; go 1.19 github.com/waku-org/go-waku/logging github.com/waku-org/go-waku/waku/persistence