refine buffer size

pull/255/head
Darien Raymond 8 years ago
parent 2ae8e5d033
commit 0da987ec43
No known key found for this signature in database
GPG Key ID: 7251FFA14BB18169

@ -41,33 +41,18 @@ func (this *Config) GetSendingInFlightSize() uint32 {
} }
func (this *Config) GetSendingBufferSize() uint32 { func (this *Config) GetSendingBufferSize() uint32 {
size := this.WriteBuffer / this.Mtu return this.GetSendingInFlightSize() + this.WriteBuffer/this.Mtu
if size < this.GetSendingInFlightSize() {
size = this.GetSendingInFlightSize()
}
return size
} }
func (this *Config) GetReceivingWindowSize() uint32 { func (this *Config) GetReceivingBufferSize() uint32 {
size := this.DownlinkCapacity * 1024 * 1024 / this.Mtu / (1000 / this.Tti) / 2 size := this.DownlinkCapacity * 1024 * 1024 / this.Mtu / (1000 / this.Tti) / 2
if size < 8 { if size < 8 {
size = 8 size = 8
} }
size += this.ReadBuffer / this.Mtu
return size return size
} }
func (this *Config) GetReceivingBufferSize() uint32 {
bufferSize := this.ReadBuffer / this.Mtu
windowSize := this.DownlinkCapacity * 1024 * 1024 / this.Mtu / (1000 / this.Tti) / 2
if windowSize < 8 {
windowSize = 8
}
if bufferSize < windowSize {
bufferSize = windowSize
}
return bufferSize
}
func DefaultConfig() Config { func DefaultConfig() Config {
return Config{ return Config{
Mtu: 1350, Mtu: 1350,

Loading…
Cancel
Save