improve mesh connectivity reporting
This commit is contained in:
parent
c2b7b1e426
commit
9a75883846
@ -103,7 +103,7 @@ function fetchLatestState (cb) {
|
||||
// update observables
|
||||
app.observ.peers(app.peers)
|
||||
var stats = require('./util').getPubStats()
|
||||
app.observ.hasSyncIssue(!stats.membersof || !stats.active)
|
||||
app.observ.hasSyncIssue(stats.hasSyncIssue)
|
||||
for (var k in app.indexCounts)
|
||||
if (app.observ.indexCounts[k])
|
||||
app.observ.indexCounts[k](app.indexCounts[k])
|
||||
|
@ -32,7 +32,7 @@ module.exports = function () {
|
||||
var warning
|
||||
if (stats.membersof === 0)
|
||||
warning = h('p', com.icon('warning-sign'), ' You need to join a pub if you want to communicate across the Internet!')
|
||||
else if (stats.active === 0)
|
||||
else if (stats.active === 0 && stats.untried === 0)
|
||||
warning = h('p', com.icon('warning-sign'), ' None of your pubs are responding! Are you connected to the Internet?')
|
||||
|
||||
return h('.pub-status',
|
||||
|
@ -284,7 +284,7 @@ exports.decryptThread = function (thread, cb) {
|
||||
}
|
||||
|
||||
exports.getPubStats = function () {
|
||||
var membersof=0, active=0
|
||||
var membersof=0, active=0, untried=0
|
||||
app.peers.forEach(function (peer) {
|
||||
// filter out LAN peers
|
||||
if (peer.host == 'localhost' || peer.host.indexOf('192.168.') === 0)
|
||||
@ -293,9 +293,12 @@ exports.getPubStats = function () {
|
||||
membersof++
|
||||
if (peer.time && peer.time.connect && (peer.time.connect > peer.time.attempt) || peer.connected)
|
||||
active++
|
||||
if (!peer.time || !peer.time.attempt)
|
||||
untried++
|
||||
}
|
||||
})
|
||||
return { membersof: membersof, active: active }
|
||||
|
||||
return { membersof: membersof, active: active, untried: untried, hasSyncIssue: (!membersof || (!untried && !active)) }
|
||||
}
|
||||
|
||||
exports.getExtLinkName = function (link) {
|
||||
|
@ -110,7 +110,7 @@ function onGossipEvent (e) {
|
||||
|
||||
// update observables
|
||||
app.observ.peers(app.peers)
|
||||
app.observ.hasSyncIssue(!stats.membersof || !stats.active)
|
||||
app.observ.hasSyncIssue(stats.hasSyncIssue)
|
||||
}
|
||||
|
||||
function onReplicationEvent (e) {
|
||||
|
Loading…
Reference in New Issue
Block a user