lib/config, lib/connections: Configurables for KCP, disable by default

GitHub-Pull-Request: https://github.com/syncthing/syncthing/pull/4030
This commit is contained in:
Jakob Borg
2017-03-07 12:55:50 +00:00
committed by Audrius Butkevicius
parent 0da0774ce4
commit 81af29e3e2
9 changed files with 48 additions and 24 deletions

View File

@@ -49,11 +49,13 @@ func (d *kcpDialer) Dial(id protocol.DeviceID, uri *url.URL) (internalConn, erro
return internalConn{}, err
}
opts := d.cfg.Options()
conn.SetKeepAlive(0) // yamux and stun service does keep-alives.
conn.SetStreamMode(true)
conn.SetACKNoDelay(false)
conn.SetWindowSize(kcpSendWindowSize, kcpReceiveWindowSize)
conn.SetNoDelay(kcpNoDelay, kcpUpdateInterval, kcpFastResend, kcpCongestionControl)
conn.SetWindowSize(opts.KCPSendWindowSize, opts.KCPReceiveWindowSize)
conn.SetNoDelay(boolInt(opts.KCPNoDelay), opts.KCPUpdateIntervalMs, boolInt(opts.KCPFastResend), boolInt(!opts.KCPCongestionControl))
ses, err := yamux.Client(conn, yamuxConfig)
if err != nil {