diff options
author | Jason A. Donenfeld <Jason@zx2c4.com> | 2021-01-28 18:56:58 +0100 |
---|---|---|
committer | Jason A. Donenfeld <Jason@zx2c4.com> | 2021-01-28 18:56:58 +0100 |
commit | f0f27d7fd242587ccb966c6d2e074dafe5ab7349 (patch) | |
tree | 35e5a0d3de1d0785d7af628a155faceef79823ad | |
parent | d4112d9096f4bdd68f1a109bb12df82f5f4ca5a0 (diff) |
device: reduce nesting when staging packet
Suggested-by: Josh Bleecher Snyder <josh@tailscale.com>
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
-rw-r--r-- | device/send.go | 12 |
1 files 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: } } } |