git ssb

0+

arj / scuttlebot



forked from Dominic / scuttlebot

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 PM
Parent: 9d686ee70c6b2073da626fa08e38a8e988b5c5b4

Files changed

plugins/gossip/schedule.jschanged
plugins/gossip/schedule.jsView
@@ -57,9 +57,9 @@
5757
5858 //select peers which have never been successfully connected to yet,
5959 //but have been tried.
6060 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)
6262 }
6363
6464 function isLongterm (e) {
6565 return e.ping && e.ping.rtt && e.ping.rtt.mean > 0
@@ -191,9 +191,9 @@
191191
192192 var longterm = peers.filter(isConnect).filter(isLongterm).length
193193
194194 connect(peers, ts, 'legacy', exports.isLegacy, {
195- quota: 3 - longterm,
195 + quota: Math.max(3 - longterm, 0),
196196 factor: 5*min, max: 3*hour, groupMin: 5*min,
197197 disable: !conf('global', true)
198198 })
199199

Built with git-ssb-web