git ssb

4+

Dominic / scuttlebot



Commit 89c3bab207307411d3f1ae88e16c193033db53e6

only read state file once!

Dominic Tarr committed on 12/11/2018, 11:44:33 PM
Parent: a932c7f074a1bdec5e821264b07365ef75b454b4

Files changed

plugins/gossip/index.jschanged
plugins/gossip/index.jsView
@@ -83,12 +83,8 @@
8383 var conf = config.gossip || {}
8484
8585 var gossipJsonPath = path.join(config.path, 'gossip.json')
8686 var stateFile = AtomicFile(gossipJsonPath)
87- stateFile.get(function (err, ary) {
88- var peers = ary || []
89- server.emit('log:info', ['SBOT', ''+peers.length+' peers loaded from', gossipJsonPath])
90- })
9187
9288 var status = {}
9389
9490 //Known Peers
@@ -375,8 +371,10 @@
375371 if(Array.isArray(ary))
376372 ary.forEach(function (v) {
377373 delete v.state
378374 // don't add local peers (wait to rediscover)
375+ // adding peers back this way means old format gossip.json
376+ // will be updated to having proper address values.
379377 if(v.source !== 'local') {
380378 gossip.add(v, 'stored')
381379 }
382380 })
@@ -401,4 +399,5 @@
401399 return gossip
402400 }
403401 }
404402
403+

Built with git-ssb-web