mirror of https://github.com/v2ray/v2ray-core
rename buffer size
parent
2839ce7a88
commit
2ae8e5d033
|
@ -40,12 +40,12 @@ func (this *Config) GetSendingInFlightSize() uint32 {
|
||||||
return size
|
return size
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *Config) GetSendingWindowSize() uint32 {
|
func (this *Config) GetSendingBufferSize() uint32 {
|
||||||
return this.GetSendingInFlightSize() * 4
|
size := this.WriteBuffer / this.Mtu
|
||||||
}
|
if size < this.GetSendingInFlightSize() {
|
||||||
|
size = this.GetSendingInFlightSize()
|
||||||
func (this *Config) GetSendingQueueSize() uint32 {
|
}
|
||||||
return this.WriteBuffer / this.Mtu
|
return size
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *Config) GetReceivingWindowSize() uint32 {
|
func (this *Config) GetReceivingWindowSize() uint32 {
|
||||||
|
@ -56,8 +56,16 @@ func (this *Config) GetReceivingWindowSize() uint32 {
|
||||||
return size
|
return size
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *Config) GetReceivingQueueSize() uint32 {
|
func (this *Config) GetReceivingBufferSize() uint32 {
|
||||||
return this.ReadBuffer / this.Mtu
|
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 {
|
||||||
|
|
|
@ -123,7 +123,7 @@ type ReceivingWorker struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewReceivingWorker(kcp *Connection) *ReceivingWorker {
|
func NewReceivingWorker(kcp *Connection) *ReceivingWorker {
|
||||||
windowSize := effectiveConfig.GetReceivingQueueSize()
|
windowSize := effectiveConfig.GetReceivingBufferSize()
|
||||||
worker := &ReceivingWorker{
|
worker := &ReceivingWorker{
|
||||||
conn: kcp,
|
conn: kcp,
|
||||||
window: NewReceivingWindow(windowSize),
|
window: NewReceivingWindow(windowSize),
|
||||||
|
|
|
@ -195,7 +195,7 @@ func NewSendingWorker(kcp *Connection) *SendingWorker {
|
||||||
remoteNextNumber: 32,
|
remoteNextNumber: 32,
|
||||||
controlWindow: effectiveConfig.GetSendingInFlightSize(),
|
controlWindow: effectiveConfig.GetSendingInFlightSize(),
|
||||||
}
|
}
|
||||||
worker.window = NewSendingWindow(effectiveConfig.GetSendingQueueSize(), worker, worker.OnPacketLoss)
|
worker.window = NewSendingWindow(effectiveConfig.GetSendingBufferSize(), worker, worker.OnPacketLoss)
|
||||||
return worker
|
return worker
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue