From 01d3aaa7f418dd0ca86643ddcc8c82544cb8398b Mon Sep 17 00:00:00 2001 From: Josh Bleecher Snyder Date: Fri, 4 Dec 2020 14:26:51 -0800 Subject: [PATCH] device: use labeled for loop instead of goto Minor code cleanup; no functional changes. Signed-off-by: Josh Bleecher Snyder --- device/send.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/device/send.go b/device/send.go index d202b62..fa4da0e 100644 --- a/device/send.go +++ b/device/send.go @@ -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