mirror of https://github.com/ehang-io/nps
change initial window size
parent
405f41f87f
commit
32e3d411ad
|
@ -190,7 +190,7 @@ func (Self *ReceiveWindow) New(mux *Mux) {
|
||||||
// initial a window for receive
|
// initial a window for receive
|
||||||
Self.bufQueue.New()
|
Self.bufQueue.New()
|
||||||
Self.element = common.ListElementPool.Get()
|
Self.element = common.ListElementPool.Get()
|
||||||
Self.maxSize = common.MAXIMUM_SEGMENT_SIZE
|
Self.maxSize = common.MAXIMUM_SEGMENT_SIZE * 10
|
||||||
Self.mux = mux
|
Self.mux = mux
|
||||||
Self.window.New()
|
Self.window.New()
|
||||||
}
|
}
|
||||||
|
@ -212,8 +212,8 @@ func (Self *ReceiveWindow) calcSize() {
|
||||||
conns := Self.mux.connMap.Size()
|
conns := Self.mux.connMap.Size()
|
||||||
n := uint32(math.Float64frombits(atomic.LoadUint64(&Self.mux.latency)) *
|
n := uint32(math.Float64frombits(atomic.LoadUint64(&Self.mux.latency)) *
|
||||||
Self.mux.bw.Get() / float64(conns))
|
Self.mux.bw.Get() / float64(conns))
|
||||||
if n < common.MAXIMUM_SEGMENT_SIZE*2 {
|
if n < common.MAXIMUM_SEGMENT_SIZE*10 {
|
||||||
n = common.MAXIMUM_SEGMENT_SIZE * 2
|
n = common.MAXIMUM_SEGMENT_SIZE * 10
|
||||||
}
|
}
|
||||||
bufLen := Self.bufQueue.Len()
|
bufLen := Self.bufQueue.Len()
|
||||||
if n < bufLen {
|
if n < bufLen {
|
||||||
|
@ -381,8 +381,8 @@ type SendWindow struct {
|
||||||
|
|
||||||
func (Self *SendWindow) New(mux *Mux) {
|
func (Self *SendWindow) New(mux *Mux) {
|
||||||
Self.setSizeCh = make(chan struct{})
|
Self.setSizeCh = make(chan struct{})
|
||||||
Self.maxSize = common.MAXIMUM_SEGMENT_SIZE
|
Self.maxSize = common.MAXIMUM_SEGMENT_SIZE * 10
|
||||||
atomic.AddUint64(&Self.remainingWait, uint64(common.MAXIMUM_SEGMENT_SIZE)<<dequeueBits)
|
atomic.AddUint64(&Self.remainingWait, uint64(common.MAXIMUM_SEGMENT_SIZE*10)<<dequeueBits)
|
||||||
Self.mux = mux
|
Self.mux = mux
|
||||||
Self.window.New()
|
Self.window.New()
|
||||||
}
|
}
|
||||||
|
|
|
@ -396,7 +396,7 @@ func (Self *bandwidth) StartRead() {
|
||||||
if Self.readStart.IsZero() {
|
if Self.readStart.IsZero() {
|
||||||
Self.readStart = time.Now()
|
Self.readStart = time.Now()
|
||||||
}
|
}
|
||||||
if Self.bufLength >= 3072000 {
|
if Self.bufLength >= common.MAXIMUM_SEGMENT_SIZE*300 {
|
||||||
Self.lastReadStart, Self.readStart = Self.readStart, time.Now()
|
Self.lastReadStart, Self.readStart = Self.readStart, time.Now()
|
||||||
Self.calcBandWidth()
|
Self.calcBandWidth()
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue