mirror of https://github.com/v2ray/v2ray-core
shrink buf in time
parent
2169dcd7da
commit
8e98ede75d
|
@ -279,6 +279,7 @@ func (kcp *KCP) Input(data []byte) int {
|
|||
kcp.update_ack(_itimediff(kcp.current, ts))
|
||||
}
|
||||
kcp.parse_ack(sn)
|
||||
kcp.shrink_buf()
|
||||
if flag == 0 {
|
||||
flag = 1
|
||||
maxack = sn
|
||||
|
@ -300,9 +301,9 @@ func (kcp *KCP) Input(data []byte) int {
|
|||
}
|
||||
kcp.HandleReceivingNext(seg.ReceivinNext)
|
||||
kcp.HandleSendingNext(seg.SendingNext)
|
||||
kcp.shrink_buf()
|
||||
default:
|
||||
}
|
||||
kcp.shrink_buf()
|
||||
}
|
||||
|
||||
if flag != 0 {
|
||||
|
|
|
@ -53,6 +53,10 @@ func (this *SendingWindow) Clear(una uint32) {
|
|||
}
|
||||
|
||||
func (this *SendingWindow) Remove(idx uint32) {
|
||||
if this.len == 0 {
|
||||
return
|
||||
}
|
||||
|
||||
pos := (this.start + idx) % this.cap
|
||||
seg := this.data[pos]
|
||||
if seg == nil {
|
||||
|
@ -80,6 +84,9 @@ func (this *SendingWindow) Remove(idx uint32) {
|
|||
}
|
||||
|
||||
func (this *SendingWindow) HandleFastAck(number uint32) {
|
||||
if this.len == 0 {
|
||||
return
|
||||
}
|
||||
|
||||
for i := this.start; ; i = this.next[i] {
|
||||
seg := this.data[i]
|
||||
|
|
Loading…
Reference in New Issue