fix_: no peers available supporting LightPush protocol after network restored from disabled state (#6153)

Fix:

- https://github.com/status-im/status-mobile/issues/21452
- https://github.com/status-im/status-mobile/issues/21394

Might also fix part (missing messages) of https://github.com/status-im/status-mobile/issues/21172

Related mobile PR https://github.com/status-im/status-mobile/pull/21730
This commit is contained in:
frank 2024-12-06 21:22:55 +08:00 committed by GitHub
parent 9a94a82fd6
commit 55befd839e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -1705,7 +1705,15 @@ func (w *Waku) handleNetworkChangeFromApp(state connection.State) {
}
}
func (w *Waku) isGoingOnline(state connection.State) bool {
return !state.Offline && !w.onlineChecker.IsOnline()
}
func (w *Waku) ConnectionChanged(state connection.State) {
if w.isGoingOnline(state) {
//TODO: analyze if we need to discover and connect to peers for relay.
w.discoverAndConnectPeers()
}
isOnline := !state.Offline
if w.cfg.LightClient {
//TODO: Update this as per https://github.com/waku-org/go-waku/issues/1114
@ -1716,10 +1724,7 @@ func (w *Waku) ConnectionChanged(state connection.State) {
w.handleNetworkChangeFromApp(state)
} else {
// for lightClient state update and onlineChange is handled in filterManager.
// going online
if isOnline && !w.onlineChecker.IsOnline() {
//TODO: analyze if we need to discover and connect to peers for relay.
w.discoverAndConnectPeers()
if w.isGoingOnline(state) {
select {
case w.goingOnline <- struct{}{}:
default: