瀏覽代碼

fix window write loss

ffdfgdfg 5 年之前
父節點
當前提交
847f0ce1d4
共有 1 個文件被更改,包括 3 次插入3 次删除
  1. 3 3
      lib/mux/conn.go

+ 3 - 3
lib/mux/conn.go

@@ -223,10 +223,10 @@ func (Self *window) SetSendBuf(buf []byte) {
 func (Self *window) fullSlide() {
 	// slide by allocate
 	newBuf := common.WindowBuff.Get()
-	copy(newBuf[0:Self.len()], Self.windowBuff[Self.off:])
-	Self.off = 0
+	Self.liteSlide()
+	n := copy(newBuf[:Self.len()], Self.windowBuff)
 	common.WindowBuff.Put(Self.windowBuff)
-	Self.windowBuff = newBuf
+	Self.windowBuff = newBuf[:n]
 	return
 }