diff --git a/go.mod b/go.mod index 6fb945a47..4c004c91f 100644 --- a/go.mod +++ b/go.mod @@ -95,7 +95,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.27.2 - github.com/waku-org/go-waku v0.8.1-0.20241105174537-213d38225bd9 + github.com/waku-org/go-waku v0.8.1-0.20241109102929-aadfbd6bd191 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 2efbff856..d8d3f7c97 100644 --- a/go.sum +++ b/go.sum @@ -2140,8 +2140,8 @@ github.com/waku-org/go-libp2p-pubsub v0.12.0-gowaku.0.20240823143342-b0f2429ca27 github.com/waku-org/go-libp2p-pubsub v0.12.0-gowaku.0.20240823143342-b0f2429ca27f/go.mod h1:Oi0zw9aw8/Y5GC99zt+Ef2gYAl+0nZlwdJonDyOz/sE= github.com/waku-org/go-libp2p-rendezvous v0.0.0-20240110193335-a67d1cc760a0 h1:R4YYx2QamhBRl/moIxkDCNW+OP7AHbyWLBygDc/xIMo= github.com/waku-org/go-libp2p-rendezvous v0.0.0-20240110193335-a67d1cc760a0/go.mod h1:EhZP9fee0DYjKH/IOQvoNSy1tSHp2iZadsHGphcAJgY= -github.com/waku-org/go-waku v0.8.1-0.20241105174537-213d38225bd9 h1:c/h9xHPKPUz8tHj8BUuy261NbdS0IA8nDnhwz+qR5EI= -github.com/waku-org/go-waku v0.8.1-0.20241105174537-213d38225bd9/go.mod h1:1BRnyg2mQ2aBNLTBaPq6vEvobzywGykPOhGQFbHGf74= +github.com/waku-org/go-waku v0.8.1-0.20241109102929-aadfbd6bd191 h1:SfSMQxlD70c628fMMJ7zU/4TqcV02/Rjb0jBIjRijGc= +github.com/waku-org/go-waku v0.8.1-0.20241109102929-aadfbd6bd191/go.mod h1:1BRnyg2mQ2aBNLTBaPq6vEvobzywGykPOhGQFbHGf74= 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/api/missing/missing_messages.go b/vendor/github.com/waku-org/go-waku/waku/v2/api/missing/missing_messages.go index ca8b63fb7..2a249d5db 100644 --- a/vendor/github.com/waku-org/go-waku/waku/v2/api/missing/missing_messages.go +++ b/vendor/github.com/waku-org/go-waku/waku/v2/api/missing/missing_messages.go @@ -33,6 +33,7 @@ type MessageTracker interface { // MissingMessageVerifier is used to periodically retrieve missing messages from store nodes that have some specific criteria type MissingMessageVerifier struct { ctx context.Context + cancel context.CancelFunc params missingMessageVerifierParams messageTracker MessageTracker @@ -96,7 +97,9 @@ func (m *MissingMessageVerifier) SetCriteriaInterest(peerID peer.ID, contentFilt } func (m *MissingMessageVerifier) Start(ctx context.Context) { + ctx, cancelFunc := context.WithCancel(ctx) m.ctx = ctx + m.cancel = cancelFunc m.criteriaInterest = make(map[string]criteriaInterest) c := make(chan *protocol.Envelope, 1000) @@ -139,6 +142,10 @@ func (m *MissingMessageVerifier) Start(ctx context.Context) { }() } +func (m *MissingMessageVerifier) Stop() { + m.cancel() +} + func (m *MissingMessageVerifier) fetchHistory(c chan<- *protocol.Envelope, interest criteriaInterest) { contentTopics := interest.contentFilter.ContentTopics.ToList() for i := 0; i < len(contentTopics); i += maxContentTopicsPerRequest { diff --git a/vendor/modules.txt b/vendor/modules.txt index 5289cebe7..908b83e9b 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -1031,7 +1031,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.20241105174537-213d38225bd9 +# github.com/waku-org/go-waku v0.8.1-0.20241109102929-aadfbd6bd191 ## explicit; go 1.21 github.com/waku-org/go-waku/logging github.com/waku-org/go-waku/tests diff --git a/wakuv2/waku.go b/wakuv2/waku.go index db9d3d7c7..5819eb8dd 100644 --- a/wakuv2/waku.go +++ b/wakuv2/waku.go @@ -1773,6 +1773,12 @@ func (w *Waku) ConnectionChanged(state connection.State) { // update state w.onlineChecker.SetOnline(isOnline) } + if isOnline && !w.onlineChecker.IsOnline() { + w.missingMsgVerifier.Start(w.ctx) + } + if !isOnline && w.onlineChecker.IsOnline() { + w.missingMsgVerifier.Stop() + } w.state = state }