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