Commit 89c3bab207307411d3f1ae88e16c193033db53e6
only read state file once!
Dominic Tarr committed on 12/11/2018, 11:44:33 PMParent: a932c7f074a1bdec5e821264b07365ef75b454b4
Files changed
plugins/gossip/index.js | changed |
plugins/gossip/index.js | ||
---|---|---|
@@ -83,12 +83,8 @@ | ||
83 | 83 | var conf = config.gossip || {} |
84 | 84 | |
85 | 85 | var gossipJsonPath = path.join(config.path, 'gossip.json') |
86 | 86 | 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 | - }) | |
91 | 87 | |
92 | 88 | var status = {} |
93 | 89 | |
94 | 90 | //Known Peers |
@@ -375,8 +371,10 @@ | ||
375 | 371 | if(Array.isArray(ary)) |
376 | 372 | ary.forEach(function (v) { |
377 | 373 | delete v.state |
378 | 374 | // 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. | |
379 | 377 | if(v.source !== 'local') { |
380 | 378 | gossip.add(v, 'stored') |
381 | 379 | } |
382 | 380 | }) |
@@ -401,4 +399,5 @@ | ||
401 | 399 | return gossip |
402 | 400 | } |
403 | 401 | } |
404 | 402 | |
403 | + |
Built with git-ssb-web