device: always name *Queue*Element variables elem

They're called elem in most places.
Rename a few local variables to make it consistent.
This makes it easier to grep the code for things like elem.Drop.

Signed-off-by: Josh Bleecher Snyder <josh@tailscale.com>
This commit is contained in:
Josh Bleecher Snyder
2020-12-15 16:00:52 -08:00
committed by Jason A. Donenfeld
parent 2832e96339
commit c8faa34cde
3 changed files with 26 additions and 26 deletions

View File

@@ -56,26 +56,26 @@ func (elem *QueueInboundElement) IsDropped() bool {
return atomic.LoadInt32(&elem.dropped) == AtomicTrue
}
func (device *Device) addToInboundAndDecryptionQueues(inboundQueue chan *QueueInboundElement, decryptionQueue chan *QueueInboundElement, element *QueueInboundElement) bool {
func (device *Device) addToInboundAndDecryptionQueues(inboundQueue chan *QueueInboundElement, decryptionQueue chan *QueueInboundElement, elem *QueueInboundElement) bool {
select {
case inboundQueue <- element:
case inboundQueue <- elem:
select {
case decryptionQueue <- element:
case decryptionQueue <- elem:
return true
default:
element.Drop()
element.Unlock()
elem.Drop()
elem.Unlock()
return false
}
default:
device.PutInboundElement(element)
device.PutInboundElement(elem)
return false
}
}
func (device *Device) addToHandshakeQueue(queue chan QueueHandshakeElement, element QueueHandshakeElement) bool {
func (device *Device) addToHandshakeQueue(queue chan QueueHandshakeElement, elem QueueHandshakeElement) bool {
select {
case queue <- element:
case queue <- elem:
return true
default:
return false