mirror of
https://github.com/octoleo/syncthing.git
synced 2024-11-10 15:20:56 +00:00
lib/connections: Don't info log about LAN if there are no rate limits (#5242)
This commit is contained in:
parent
714a47ffb0
commit
c9d6366d75
@ -134,37 +134,39 @@ func (lim *limiter) CommitConfiguration(from, to config.Configuration) bool {
|
|||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
limited := false
|
||||||
|
sendLimitStr := "is unlimited"
|
||||||
|
recvLimitStr := "is unlimited"
|
||||||
|
|
||||||
// The rate variables are in KiB/s in the config (despite the camel casing
|
// The rate variables are in KiB/s in the config (despite the camel casing
|
||||||
// of the name). We multiply by 1024 to get bytes/s.
|
// of the name). We multiply by 1024 to get bytes/s.
|
||||||
if to.Options.MaxRecvKbps <= 0 {
|
if to.Options.MaxRecvKbps <= 0 {
|
||||||
lim.read.SetLimit(rate.Inf)
|
lim.read.SetLimit(rate.Inf)
|
||||||
} else {
|
} else {
|
||||||
lim.read.SetLimit(1024 * rate.Limit(to.Options.MaxRecvKbps))
|
lim.read.SetLimit(1024 * rate.Limit(to.Options.MaxRecvKbps))
|
||||||
|
recvLimitStr = fmt.Sprintf("limit is %d KiB/s", to.Options.MaxRecvKbps)
|
||||||
|
limited = true
|
||||||
}
|
}
|
||||||
|
|
||||||
if to.Options.MaxSendKbps <= 0 {
|
if to.Options.MaxSendKbps <= 0 {
|
||||||
lim.write.SetLimit(rate.Inf)
|
lim.write.SetLimit(rate.Inf)
|
||||||
} else {
|
} else {
|
||||||
lim.write.SetLimit(1024 * rate.Limit(to.Options.MaxSendKbps))
|
lim.write.SetLimit(1024 * rate.Limit(to.Options.MaxSendKbps))
|
||||||
|
sendLimitStr = fmt.Sprintf("limit is %d KiB/s", to.Options.MaxSendKbps)
|
||||||
|
limited = true
|
||||||
}
|
}
|
||||||
|
|
||||||
lim.limitsLAN.set(to.Options.LimitBandwidthInLan)
|
lim.limitsLAN.set(to.Options.LimitBandwidthInLan)
|
||||||
|
|
||||||
sendLimitStr := "is unlimited"
|
|
||||||
recvLimitStr := "is unlimited"
|
|
||||||
if to.Options.MaxSendKbps > 0 {
|
|
||||||
sendLimitStr = fmt.Sprintf("limit is %d KiB/s", to.Options.MaxSendKbps)
|
|
||||||
}
|
|
||||||
if to.Options.MaxRecvKbps > 0 {
|
|
||||||
recvLimitStr = fmt.Sprintf("limit is %d KiB/s", to.Options.MaxRecvKbps)
|
|
||||||
}
|
|
||||||
l.Infof("Overall send rate %s, receive rate %s", sendLimitStr, recvLimitStr)
|
l.Infof("Overall send rate %s, receive rate %s", sendLimitStr, recvLimitStr)
|
||||||
|
|
||||||
|
if limited {
|
||||||
if to.Options.LimitBandwidthInLan {
|
if to.Options.LimitBandwidthInLan {
|
||||||
l.Infoln("Rate limits apply to LAN connections")
|
l.Infoln("Rate limits apply to LAN connections")
|
||||||
} else {
|
} else {
|
||||||
l.Infoln("Rate limits do not apply to LAN connections")
|
l.Infoln("Rate limits do not apply to LAN connections")
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user