mirror of
https://github.com/v2fly/v2ray-core.git
synced 2025-01-21 16:56:27 -05:00
shrink buf in time
This commit is contained in:
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
Block a user