1
0
Эх сурвалжийг харах

change initial window size

ffdfgdfg 5 жил өмнө
parent
commit
32e3d411ad
2 өөрчлөгдсөн 6 нэмэгдсэн , 6 устгасан
  1. 5 5
      lib/mux/conn.go
  2. 1 1
      lib/mux/mux.go

+ 5 - 5
lib/mux/conn.go

@@ -190,7 +190,7 @@ func (Self *ReceiveWindow) New(mux *Mux) {
 	// initial a window for receive
 	Self.bufQueue.New()
 	Self.element = common.ListElementPool.Get()
-	Self.maxSize = common.MAXIMUM_SEGMENT_SIZE
+	Self.maxSize = common.MAXIMUM_SEGMENT_SIZE * 10
 	Self.mux = mux
 	Self.window.New()
 }
@@ -212,8 +212,8 @@ func (Self *ReceiveWindow) calcSize() {
 		conns := Self.mux.connMap.Size()
 		n := uint32(math.Float64frombits(atomic.LoadUint64(&Self.mux.latency)) *
 			Self.mux.bw.Get() / float64(conns))
-		if n < common.MAXIMUM_SEGMENT_SIZE*2 {
-			n = common.MAXIMUM_SEGMENT_SIZE * 2
+		if n < common.MAXIMUM_SEGMENT_SIZE*10 {
+			n = common.MAXIMUM_SEGMENT_SIZE * 10
 		}
 		bufLen := Self.bufQueue.Len()
 		if n < bufLen {
@@ -381,8 +381,8 @@ type SendWindow struct {
 
 func (Self *SendWindow) New(mux *Mux) {
 	Self.setSizeCh = make(chan struct{})
-	Self.maxSize = common.MAXIMUM_SEGMENT_SIZE
-	atomic.AddUint64(&Self.remainingWait, uint64(common.MAXIMUM_SEGMENT_SIZE)<<dequeueBits)
+	Self.maxSize = common.MAXIMUM_SEGMENT_SIZE * 10
+	atomic.AddUint64(&Self.remainingWait, uint64(common.MAXIMUM_SEGMENT_SIZE*10)<<dequeueBits)
 	Self.mux = mux
 	Self.window.New()
 }

+ 1 - 1
lib/mux/mux.go

@@ -396,7 +396,7 @@ func (Self *bandwidth) StartRead() {
 	if Self.readStart.IsZero() {
 		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.calcBandWidth()
 	}