From f0f27d7fd242587ccb966c6d2e074dafe5ab7349 Mon Sep 17 00:00:00 2001 From: "Jason A. Donenfeld" Date: Thu, 28 Jan 2021 18:56:58 +0100 Subject: device: reduce nesting when staging packet Suggested-by: Josh Bleecher Snyder Signed-off-by: Jason A. Donenfeld --- device/send.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/device/send.go b/device/send.go index eb861b1..04d2001 100644 --- a/device/send.go +++ b/device/send.go @@ -286,12 +286,12 @@ func (peer *Peer) StagePacket(elem *QueueOutboundElement) { case peer.queue.staged <- elem: return default: - select { - case tooOld := <-peer.queue.staged: - peer.device.PutMessageBuffer(tooOld.buffer) - peer.device.PutOutboundElement(tooOld) - default: - } + } + select { + case tooOld := <-peer.queue.staged: + peer.device.PutMessageBuffer(tooOld.buffer) + peer.device.PutOutboundElement(tooOld) + default: } } } -- cgit v1.2.3