Adjust some config defaults

This commit is contained in:
Matt Joiner 2018-02-16 12:15:56 +11:00
parent 377cb62da9
commit aab77ab05d
1 changed files with 4 additions and 3 deletions

View File

@ -130,16 +130,17 @@ func (cfg *Config) setDefaults() {
cfg.MinDialTimeout = 5 * time.Second cfg.MinDialTimeout = 5 * time.Second
} }
if cfg.EstablishedConnsPerTorrent == 0 { if cfg.EstablishedConnsPerTorrent == 0 {
cfg.EstablishedConnsPerTorrent = 80 cfg.EstablishedConnsPerTorrent = 50
} }
if cfg.HalfOpenConnsPerTorrent == 0 { if cfg.HalfOpenConnsPerTorrent == 0 {
cfg.HalfOpenConnsPerTorrent = 80 cfg.HalfOpenConnsPerTorrent = (cfg.EstablishedConnsPerTorrent + 1) / 2
} }
if cfg.TorrentPeersHighWater == 0 { if cfg.TorrentPeersHighWater == 0 {
// Memory and freshness are the concern here.
cfg.TorrentPeersHighWater = 500 cfg.TorrentPeersHighWater = 500
} }
if cfg.TorrentPeersLowWater == 0 { if cfg.TorrentPeersLowWater == 0 {
cfg.TorrentPeersLowWater = 50 cfg.TorrentPeersLowWater = 2 * cfg.HalfOpenConnsPerTorrent
} }
if cfg.HandshakesTimeout == 0 { if cfg.HandshakesTimeout == 0 {
cfg.HandshakesTimeout = 20 * time.Second cfg.HandshakesTimeout = 20 * time.Second