5
0
mirror of https://github.com/cwinfo/yggdrasil-go.git synced 2024-11-22 14:10:28 +00:00

cleaner way to handle seq/idle checks for the peer

This commit is contained in:
Arceliar 2020-05-24 17:49:48 -05:00
parent 4382368b08
commit 38dcbb1e2f

View File

@ -290,8 +290,8 @@ func (p *peer) _handleIdle() {
break
}
}
if len(packets) > 0 {
p.seq++
if len(packets) > 0 {
p.bytesSent += uint64(size)
p.intf.out(packets)
p.max = p.queue.size
@ -304,7 +304,7 @@ func (p *peer) _handleIdle() {
func (p *peer) dropFromQueue(from phony.Actor, seq uint64) {
p.Act(from, func() {
p.Act(nil, func() {
if seq == p.seq && !p.idle {
if seq == p.seq {
p.drop = true
p.max = p.queue.size + streamMsgSize
}