5
0
mirror of https://github.com/cwinfo/yggdrasil-go.git synced 2024-11-12 23:20:28 +00:00

Merge pull request #701 from Arceliar/buffers

More buffer fine-tuning
This commit is contained in:
Arceliar 2020-05-25 16:30:43 -05:00 committed by GitHub
commit dbc3b9b4c4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

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