diff --git a/go.mod b/go.mod index 1af517193..b3e11c03f 100644 --- a/go.mod +++ b/go.mod @@ -90,7 +90,7 @@ require ( github.com/schollz/peerdiscovery v1.7.0 github.com/siphiuel/lc-proxy-wrapper v0.0.0-20230516150924-246507cee8c7 github.com/urfave/cli/v2 v2.24.4 - github.com/waku-org/go-waku v0.8.1-0.20240322182925-dd81e1d46971 + github.com/waku-org/go-waku v0.8.1-0.20240415131212-6d889ca3e2fe 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 0fcdcefde..9b774534a 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.20240322182925-dd81e1d46971 h1:HSR8JmscSmCtpIAzFO5sNZRyYZbO8nw7rGM3QcC9bak= -github.com/waku-org/go-waku v0.8.1-0.20240322182925-dd81e1d46971/go.mod h1:RjTvkTrIwpoT1cM9HeQqwa2Q7t7WOkb3hpuB/zuZ6SM= +github.com/waku-org/go-waku v0.8.1-0.20240415131212-6d889ca3e2fe h1:rJF7qKODzvWx03iaLbYyjvA62crnCaDqIN661aqCQ8c= +github.com/waku-org/go-waku v0.8.1-0.20240415131212-6d889ca3e2fe/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/service/common_discovery_service.go b/vendor/github.com/waku-org/go-waku/waku/v2/service/common_discovery_service.go index c22f18f11..651c349bf 100644 --- a/vendor/github.com/waku-org/go-waku/waku/v2/service/common_discovery_service.go +++ b/vendor/github.com/waku-org/go-waku/waku/v2/service/common_discovery_service.go @@ -49,8 +49,6 @@ func (sp *CommonDiscoveryService) GetListeningChan() <-chan PeerData { return sp.channel } func (sp *CommonDiscoveryService) PushToChan(data PeerData) bool { - sp.RLock() - defer sp.RUnlock() if err := sp.ErrOnNotRunning(); err != nil { return false } diff --git a/vendor/github.com/waku-org/go-waku/waku/v2/service/common_service.go b/vendor/github.com/waku-org/go-waku/waku/v2/service/common_service.go index 9bf3ea12b..026651e42 100644 --- a/vendor/github.com/waku-org/go-waku/waku/v2/service/common_service.go +++ b/vendor/github.com/waku-org/go-waku/waku/v2/service/common_service.go @@ -4,6 +4,7 @@ import ( "context" "errors" "sync" + "sync/atomic" ) // this is common layout for all the services that require mutex protection and a guarantee that all running goroutines will be finished before stop finishes execution. This guarantee comes from waitGroup all one has to use CommonService.WaitGroup() in the goroutines that should finish by the end of stop function. @@ -12,7 +13,7 @@ type CommonService struct { cancel context.CancelFunc ctx context.Context wg sync.WaitGroup - started bool + started atomic.Bool } func NewCommonService() *CommonService { @@ -28,13 +29,13 @@ func NewCommonService() *CommonService { func (sp *CommonService) Start(ctx context.Context, fn func() error) error { sp.Lock() defer sp.Unlock() - if sp.started { + if sp.started.Load() { return ErrAlreadyStarted } - sp.started = true + sp.started.Store(true) sp.ctx, sp.cancel = context.WithCancel(ctx) if err := fn(); err != nil { - sp.started = false + sp.started.Store(false) sp.cancel() return err } @@ -48,18 +49,18 @@ var ErrNotStarted = errors.New("not started") func (sp *CommonService) Stop(fn func()) { sp.Lock() defer sp.Unlock() - if !sp.started { + if !sp.started.Load() { return } sp.cancel() fn() sp.wg.Wait() - sp.started = false + sp.started.Store(false) } // This is not a mutex protected function, it is up to the caller to use it in a mutex protected context func (sp *CommonService) ErrOnNotRunning() error { - if !sp.started { + if !sp.started.Load() { return ErrNotStarted } return nil diff --git a/vendor/modules.txt b/vendor/modules.txt index d28af764f..69bb273f2 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.20240322182925-dd81e1d46971 +# github.com/waku-org/go-waku v0.8.1-0.20240415131212-6d889ca3e2fe ## explicit; go 1.19 github.com/waku-org/go-waku/logging github.com/waku-org/go-waku/waku/persistence