Commit 8ebaee4a7d51efc20cd4cb60c60a4b507531a6da
Don't consider a connecting peer as inactive. On my quite slow machine I was getting lots of connect/disconnects of the same peers over and over again. Turns out that gossip is checking every 2 seconds and if you have a slow machine or a slow connection, these can be seen as inactive and fall into the retry queue which will quickly meet its quota.
Anders Rune Jensen committed on 12/31/2016, 8:16:08 PMParent: 9d686ee70c6b2073da626fa08e38a8e988b5c5b4
Files changed
plugins/gossip/schedule.js | changed |
plugins/gossip/schedule.js | ||
---|---|---|
@@ -57,9 +57,9 @@ | ||
57 | 57 … | |
58 | 58 … | //select peers which have never been successfully connected to yet, |
59 | 59 … | //but have been tried. |
60 | 60 … | function isInactive (e) { |
61 | - return e.stateChange && (!e.duration || e.duration.mean == 0) | |
61 … | + return e.state !== 'connecting' && e.stateChange && (!e.duration || e.duration.mean == 0) | |
62 | 62 … | } |
63 | 63 … | |
64 | 64 … | function isLongterm (e) { |
65 | 65 … | return e.ping && e.ping.rtt && e.ping.rtt.mean > 0 |
@@ -191,9 +191,9 @@ | ||
191 | 191 … | |
192 | 192 … | var longterm = peers.filter(isConnect).filter(isLongterm).length |
193 | 193 … | |
194 | 194 … | connect(peers, ts, 'legacy', exports.isLegacy, { |
195 | - quota: 3 - longterm, | |
195 … | + quota: Math.max(3 - longterm, 0), | |
196 | 196 … | factor: 5*min, max: 3*hour, groupMin: 5*min, |
197 | 197 … | disable: !conf('global', true) |
198 | 198 … | }) |
199 | 199 … |
Built with git-ssb-web