Return network EOSE in normal mode if device is offline
This is done to prevent hang ups when the device is offline. Changelog-Added: Added the ability to load saved notes if device is offline Signed-off-by: Daniel D’Aquino <daniel@daquino.me>
This commit is contained in:
@@ -134,9 +134,14 @@ extension NostrNetworkManager {
|
|||||||
|
|
||||||
// This closure function issues (yields) an EOSE signal to the stream if all relevant conditions are met
|
// This closure function issues (yields) an EOSE signal to the stream if all relevant conditions are met
|
||||||
let yieldEOSEIfReady = {
|
let yieldEOSEIfReady = {
|
||||||
|
let connectedToNetwork = self.pool.network_monitor.currentPath.status == .satisfied
|
||||||
// In normal mode: Issuing EOSE requires EOSE from both NDB and the network, since they are all considered separate relays
|
// In normal mode: Issuing EOSE requires EOSE from both NDB and the network, since they are all considered separate relays
|
||||||
// In experimental local relay model mode: Issuing EOSE requires only EOSE from NDB, since that is the only relay that "matters"
|
// In experimental local relay model mode: Issuing EOSE requires only EOSE from NDB, since that is the only relay that "matters"
|
||||||
let canIssueEOSE = self.experimentalLocalRelayModelSupport ? ndbEOSEIssued : ndbEOSEIssued && networkEOSEIssued
|
let canIssueEOSE = self.experimentalLocalRelayModelSupport ?
|
||||||
|
(ndbEOSEIssued)
|
||||||
|
:
|
||||||
|
(ndbEOSEIssued && (networkEOSEIssued || !connectedToNetwork))
|
||||||
|
|
||||||
if canIssueEOSE {
|
if canIssueEOSE {
|
||||||
continuation.yield(.eose)
|
continuation.yield(.eose)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ class RelayPool {
|
|||||||
var delegate: Delegate?
|
var delegate: Delegate?
|
||||||
private(set) var signal: SignalModel = SignalModel()
|
private(set) var signal: SignalModel = SignalModel()
|
||||||
|
|
||||||
private let network_monitor = NWPathMonitor()
|
let network_monitor = NWPathMonitor()
|
||||||
private let network_monitor_queue = DispatchQueue(label: "io.damus.network_monitor")
|
private let network_monitor_queue = DispatchQueue(label: "io.damus.network_monitor")
|
||||||
private var last_network_status: NWPath.Status = .unsatisfied
|
private var last_network_status: NWPath.Status = .unsatisfied
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user