device: use labeled for loop instead of goto

Minor code cleanup; no functional changes.

Signed-off-by: Josh Bleecher Snyder <josh@tailscale.com>
This commit is contained in:
Josh Bleecher Snyder 2020-12-04 14:26:51 -08:00
parent b6303091fc
commit 01d3aaa7f4

View File

@ -365,8 +365,8 @@ func (peer *Peer) RoutineNonce() {
peer.routines.starting.Done()
logDebug.Println(peer, "- Routine: nonce worker - started")
NextPacket:
for {
NextPacket:
peer.queue.packetInNonceQueueIsAwaitingKey.Set(false)
select {
@ -375,7 +375,7 @@ func (peer *Peer) RoutineNonce() {
case <-peer.signals.flushNonceQueue:
flush()
goto NextPacket
continue NextPacket
case elem, ok := <-peer.queue.nonce:
@ -418,7 +418,7 @@ func (peer *Peer) RoutineNonce() {
device.PutMessageBuffer(elem.buffer)
device.PutOutboundElement(elem)
flush()
goto NextPacket
continue NextPacket
case <-peer.routines.stop:
device.PutMessageBuffer(elem.buffer)
@ -439,7 +439,7 @@ func (peer *Peer) RoutineNonce() {
atomic.StoreUint64(&keypair.sendNonce, RejectAfterMessages)
device.PutMessageBuffer(elem.buffer)
device.PutOutboundElement(elem)
goto NextPacket
continue NextPacket
}
elem.keypair = keypair