mirror of
https://github.com/amnezia-vpn/amneziawg-go.git
synced 2025-04-16 14:06:54 +02:00
device: reduce nesting when staging packet
Suggested-by: Josh Bleecher Snyder <josh@tailscale.com> Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
This commit is contained in:
parent
d4112d9096
commit
f0f27d7fd2
1 changed files with 6 additions and 6 deletions
|
@ -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:
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue