aboutsummaryrefslogtreecommitdiffstats
path: root/receive.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 /receive.go
parentUpdate copyright (diff)
downloadwireguard-go-89d2c5ed7a054bc05a21209d5a9c79ad7151f8f7.tar.xz
wireguard-go-89d2c5ed7a054bc05a21209d5a9c79ad7151f8f7.zip
Extend structs rather than embed, when possible
Diffstat (limited to '')
-rw-r--r--receive.go14
1 files changed, 7 insertions, 7 deletions
diff --git a/receive.go b/receive.go
index 170fa39..fb848eb 100644
--- a/receive.go
+++ b/receive.go
@@ -26,8 +26,8 @@ type QueueHandshakeElement struct {
}
type QueueInboundElement struct {
- dropped int32
- mutex sync.Mutex
+ dropped int32
+ sync.Mutex
buffer *[MaxMessageSize]byte
packet []byte
counter uint64
@@ -51,7 +51,7 @@ func (device *Device) addToInboundAndDecryptionQueues(inboundQueue chan *QueueIn
return true
default:
element.Drop()
- element.mutex.Unlock()
+ element.Unlock()
return false
}
default:
@@ -177,8 +177,8 @@ func (device *Device) RoutineReceiveIncoming(IP int, bind Bind) {
elem.dropped = AtomicFalse
elem.endpoint = endpoint
elem.counter = 0
- elem.mutex = sync.Mutex{}
- elem.mutex.Lock()
+ elem.Mutex = sync.Mutex{}
+ elem.Lock()
// add to decryption queues
@@ -281,7 +281,7 @@ func (device *Device) RoutineDecryption() {
elem.Drop()
device.PutMessageBuffer(elem.buffer)
}
- elem.mutex.Unlock()
+ elem.Unlock()
}
}
}
@@ -529,7 +529,7 @@ func (peer *Peer) RoutineSequentialReceiver() {
// wait for decryption
- elem.mutex.Lock()
+ elem.Lock()
if elem.IsDropped() {
continue