Browse Source

improve mesh connectivity reporting

Paul Frazee 5 years ago
parent
commit
9a75883846
4 changed files with 8 additions and 5 deletions
  1. 1
    1
      ui/lib/app.js
  2. 1
    1
      ui/lib/pages/sync.js
  3. 5
    2
      ui/lib/util.js
  4. 1
    1
      ui/main.js

+ 1
- 1
ui/lib/app.js View File

@@ -103,7 +103,7 @@ function fetchLatestState (cb) {
103 103
     // update observables
104 104
     app.observ.peers(app.peers)
105 105
     var stats = require('./util').getPubStats()
106
-    app.observ.hasSyncIssue(!stats.membersof || !stats.active)
106
+    app.observ.hasSyncIssue(stats.hasSyncIssue)
107 107
     for (var k in app.indexCounts)
108 108
       if (app.observ.indexCounts[k])
109 109
         app.observ.indexCounts[k](app.indexCounts[k])

+ 1
- 1
ui/lib/pages/sync.js View File

@@ -32,7 +32,7 @@ module.exports = function () {
32 32
         var warning
33 33
         if (stats.membersof === 0)
34 34
           warning = h('p', com.icon('warning-sign'), ' You need to join a pub if you want to communicate across the Internet!')
35
-        else if (stats.active === 0)
35
+        else if (stats.active === 0 && stats.untried === 0)
36 36
           warning = h('p', com.icon('warning-sign'), ' None of your pubs are responding! Are you connected to the Internet?')
37 37
 
38 38
         return h('.pub-status',

+ 5
- 2
ui/lib/util.js View File

@@ -284,7 +284,7 @@ exports.decryptThread = function (thread, cb) {
284 284
 }
285 285
 
286 286
 exports.getPubStats = function () {
287
-  var membersof=0, active=0
287
+  var membersof=0, active=0, untried=0
288 288
   app.peers.forEach(function (peer) {
289 289
     // filter out LAN peers
290 290
     if (peer.host == 'localhost' || peer.host.indexOf('192.168.') === 0)
@@ -293,9 +293,12 @@ exports.getPubStats = function () {
293 293
       membersof++
294 294
       if (peer.time && peer.time.connect && (peer.time.connect > peer.time.attempt) || peer.connected)
295 295
         active++
296
+      if (!peer.time || !peer.time.attempt)
297
+        untried++
296 298
     }
297 299
   })
298
-  return { membersof: membersof, active: active }
300
+  
301
+  return { membersof: membersof, active: active, untried: untried, hasSyncIssue: (!membersof || (!untried && !active)) }
299 302
 }
300 303
 
301 304
 exports.getExtLinkName = function (link) {

+ 1
- 1
ui/main.js View File

@@ -110,7 +110,7 @@ function onGossipEvent (e) {
110 110
 
111 111
   // update observables
112 112
   app.observ.peers(app.peers)
113
-  app.observ.hasSyncIssue(!stats.membersof || !stats.active)
113
+  app.observ.hasSyncIssue(stats.hasSyncIssue)
114 114
 }
115 115
 
116 116
 function onReplicationEvent (e) {

Loading…
Cancel
Save