mirror of
https://github.com/v2fly/v2ray-core.git
synced 2024-12-22 10:08:15 -05:00
Clear sending queue when peer closed
This commit is contained in:
parent
ab710f2714
commit
0613d0cf22
@ -358,6 +358,9 @@ func (this *Connection) MarkPeerClose() {
|
|||||||
if this.state == ConnStateActive {
|
if this.state == ConnStateActive {
|
||||||
this.state = ConnStatePeerClosed
|
this.state = ConnStatePeerClosed
|
||||||
}
|
}
|
||||||
|
this.kcpAccess.Lock()
|
||||||
|
this.kcp.ClearSendQueue()
|
||||||
|
this.kcpAccess.Unlock()
|
||||||
}
|
}
|
||||||
|
|
||||||
func (this *Connection) kcpInput(data []byte) {
|
func (this *Connection) kcpInput(data []byte) {
|
||||||
|
@ -842,3 +842,16 @@ func (kcp *KCP) WndSize(sndwnd, rcvwnd int) int {
|
|||||||
func (kcp *KCP) WaitSnd() int {
|
func (kcp *KCP) WaitSnd() int {
|
||||||
return len(kcp.snd_buf) + len(kcp.snd_queue)
|
return len(kcp.snd_buf) + len(kcp.snd_queue)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (this *KCP) ClearSendQueue() {
|
||||||
|
for _, seg := range this.snd_queue {
|
||||||
|
seg.Release()
|
||||||
|
}
|
||||||
|
this.snd_queue = nil
|
||||||
|
|
||||||
|
for _, seg := range this.snd_buf {
|
||||||
|
seg.Release()
|
||||||
|
}
|
||||||
|
|
||||||
|
this.snd_buf = nil
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user