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
|
@ -286,12 +286,12 @@ func (peer *Peer) StagePacket(elem *QueueOutboundElement) {
|
||||||
case peer.queue.staged <- elem:
|
case peer.queue.staged <- elem:
|
||||||
return
|
return
|
||||||
default:
|
default:
|
||||||
select {
|
}
|
||||||
case tooOld := <-peer.queue.staged:
|
select {
|
||||||
peer.device.PutMessageBuffer(tooOld.buffer)
|
case tooOld := <-peer.queue.staged:
|
||||||
peer.device.PutOutboundElement(tooOld)
|
peer.device.PutMessageBuffer(tooOld.buffer)
|
||||||
default:
|
peer.device.PutOutboundElement(tooOld)
|
||||||
}
|
default:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue