From 95743085457314b4b0e8115133a3aaef19e494de Mon Sep 17 00:00:00 2001 From: Arceliar Date: Sun, 24 May 2020 17:24:50 -0500 Subject: [PATCH 1/3] have the peer delay setting a max buffer size, in case things have unblocked in the mean time --- src/yggdrasil/peer.go | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/yggdrasil/peer.go b/src/yggdrasil/peer.go index 4463bc6..ce120b8 100644 --- a/src/yggdrasil/peer.go +++ b/src/yggdrasil/peer.go @@ -303,10 +303,12 @@ func (p *peer) _handleIdle() { func (p *peer) dropFromQueue(from phony.Actor, seq uint64) { p.Act(from, func() { - if seq == p.seq { - p.drop = true - p.max = p.queue.size + streamMsgSize - } + p.Act(nil, func() { + if seq == p.seq { + p.drop = true + p.max = p.queue.size + streamMsgSize + } + }) }) } From 4382368b0891d75aa6bbcd5fd4d9de8e01a67f40 Mon Sep 17 00:00:00 2001 From: Arceliar Date: Sun, 24 May 2020 17:43:35 -0500 Subject: [PATCH 2/3] make sure the peer isn't idle before entering drop mode --- src/yggdrasil/peer.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/yggdrasil/peer.go b/src/yggdrasil/peer.go index ce120b8..b9641fc 100644 --- a/src/yggdrasil/peer.go +++ b/src/yggdrasil/peer.go @@ -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 { + if seq == p.seq && !p.idle { p.drop = true p.max = p.queue.size + streamMsgSize } From 38dcbb1e2f8c755d718abe12c41d540698ed5bab Mon Sep 17 00:00:00 2001 From: Arceliar Date: Sun, 24 May 2020 17:49:48 -0500 Subject: [PATCH 3/3] cleaner way to handle seq/idle checks for the peer --- src/yggdrasil/peer.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/yggdrasil/peer.go b/src/yggdrasil/peer.go index b9641fc..3976c8f 100644 --- a/src/yggdrasil/peer.go +++ b/src/yggdrasil/peer.go @@ -290,8 +290,8 @@ func (p *peer) _handleIdle() { break } } + p.seq++ if len(packets) > 0 { - p.seq++ 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 }