allow capacity = 0

pull/215/head
v2ray 2016-07-04 13:31:21 +02:00
parent d5cb2e88c9
commit 6a1054a0f3
No known key found for this signature in database
GPG Key ID: 7251FFA14BB18169
1 changed files with 2 additions and 12 deletions

View File

@ -38,20 +38,10 @@ func (this *Config) UnmarshalJSON(data []byte) error {
this.Tti = tti this.Tti = tti
} }
if jsonConfig.UpCap != nil { if jsonConfig.UpCap != nil {
upCap := *jsonConfig.UpCap this.UplinkCapacity = *jsonConfig.UpCap
if upCap == 0 {
log.Error("KCP|Config: Invalid uplink capacity: ", upCap)
return common.ErrBadConfiguration
}
this.UplinkCapacity = upCap
} }
if jsonConfig.DownCap != nil { if jsonConfig.DownCap != nil {
downCap := *jsonConfig.DownCap this.DownlinkCapacity = *jsonConfig.DownCap
if downCap == 0 {
log.Error("KCP|Config: Invalid downlink capacity: ", downCap)
return common.ErrBadConfiguration
}
this.DownlinkCapacity = downCap
} }
if jsonConfig.Congestion != nil { if jsonConfig.Congestion != nil {
this.Congestion = *jsonConfig.Congestion this.Congestion = *jsonConfig.Congestion