aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2021-01-28 18:56:58 +0100
committerJason A. Donenfeld <Jason@zx2c4.com>2021-01-28 18:56:58 +0100
commitf0f27d7fd242587ccb966c6d2e074dafe5ab7349 (patch)
tree35e5a0d3de1d0785d7af628a155faceef79823ad
parentglobal: bump copyright (diff)
downloadwireguard-go-f0f27d7fd242587ccb966c6d2e074dafe5ab7349.tar.xz
wireguard-go-f0f27d7fd242587ccb966c6d2e074dafe5ab7349.zip
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.go12
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:
}
}
}