1
0
mirror of https://git.zx2c4.com/wireguard-go synced 2024-11-15 09:15:14 +01:00

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