summaryrefslogtreecommitdiffhomepage
path: root/send.go
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2019-01-03 19:04:00 +0100
committerJason A. Donenfeld <Jason@zx2c4.com>2019-02-05 12:59:42 +0100
commit89d2c5ed7a054bc05a21209d5a9c79ad7151f8f7 (patch)
treee19022fe717ddfb840599bf68e4c5a9268f8c278 /send.go
parentdff424baf8acc4d2a5858d3947761c5090d8e640 (diff)
Extend structs rather than embed, when possible
Diffstat (limited to 'send.go')
-rw-r--r--send.go14
1 files changed, 7 insertions, 7 deletions
diff --git a/send.go b/send.go
index d8627d3..b7cac04 100644
--- a/send.go
+++ b/send.go
@@ -43,7 +43,7 @@ import (
type QueueOutboundElement struct {
dropped int32
- mutex sync.Mutex
+ sync.Mutex
buffer *[MaxMessageSize]byte // slice holding the packet data
packet []byte // slice of "buffer" (always!)
nonce uint64 // nonce for encryption
@@ -55,7 +55,7 @@ func (device *Device) NewOutboundElement() *QueueOutboundElement {
elem := device.GetOutboundElement()
elem.dropped = AtomicFalse
elem.buffer = device.GetMessageBuffer()
- elem.mutex = sync.Mutex{}
+ elem.Mutex = sync.Mutex{}
elem.nonce = 0
elem.keypair = nil
elem.peer = nil
@@ -95,7 +95,7 @@ func addToOutboundAndEncryptionQueues(outboundQueue chan *QueueOutboundElement,
default:
element.Drop()
element.peer.device.PutMessageBuffer(element.buffer)
- element.mutex.Unlock()
+ element.Unlock()
}
default:
element.peer.device.PutMessageBuffer(element.buffer)
@@ -442,7 +442,7 @@ func (peer *Peer) RoutineNonce() {
elem.keypair = keypair
elem.dropped = AtomicFalse
- elem.mutex.Lock()
+ elem.Lock()
// add to parallel and sequential queue
addToOutboundAndEncryptionQueues(peer.queue.outbound, device.queue.encryption, elem)
@@ -468,7 +468,7 @@ func (device *Device) RoutineEncryption() {
if ok && !elem.IsDropped() {
elem.Drop()
device.PutMessageBuffer(elem.buffer)
- elem.mutex.Unlock()
+ elem.Unlock()
}
default:
goto out
@@ -535,7 +535,7 @@ func (device *Device) RoutineEncryption() {
elem.packet,
nil,
)
- elem.mutex.Unlock()
+ elem.Unlock()
}
}
}
@@ -588,7 +588,7 @@ func (peer *Peer) RoutineSequentialSender() {
return
}
- elem.mutex.Lock()
+ elem.Lock()
if elem.IsDropped() {
device.PutOutboundElement(elem)
continue