aboutsummaryrefslogtreecommitdiffstats
path: root/conn_linux.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 /conn_linux.go
parentUpdate copyright (diff)
downloadwireguard-go-89d2c5ed7a054bc05a21209d5a9c79ad7151f8f7.tar.xz
wireguard-go-89d2c5ed7a054bc05a21209d5a9c79ad7151f8f7.zip
Extend structs rather than embed, when possible
Diffstat (limited to 'conn_linux.go')
-rw-r--r--conn_linux.go20
1 files changed, 10 insertions, 10 deletions
diff --git a/conn_linux.go b/conn_linux.go
index 305039d..2b3a51e 100644
--- a/conn_linux.go
+++ b/conn_linux.go
@@ -654,17 +654,17 @@ func (bind *NativeBind) routineRouteListener(device *Device) {
if !ok {
break
}
- pePtr.peer.mutex.Lock()
+ pePtr.peer.Lock()
if &pePtr.peer.endpoint != pePtr.endpoint {
- pePtr.peer.mutex.Unlock()
+ pePtr.peer.Unlock()
break
}
if uint32(pePtr.peer.endpoint.(*NativeEndpoint).src4().ifindex) == ifidx {
- pePtr.peer.mutex.Unlock()
+ pePtr.peer.Unlock()
break
}
pePtr.peer.endpoint.(*NativeEndpoint).ClearSrc()
- pePtr.peer.mutex.Unlock()
+ pePtr.peer.Unlock()
}
attr = attr[attrhdr.Len:]
}
@@ -675,16 +675,16 @@ func (bind *NativeBind) routineRouteListener(device *Device) {
reqPeer = make(map[uint32]peerEndpointPtr)
reqPeerLock.Unlock()
go func() {
- device.peers.mutex.RLock()
+ device.peers.RLock()
i := uint32(1)
for _, peer := range device.peers.keyMap {
- peer.mutex.RLock()
+ peer.RLock()
if peer.endpoint == nil || peer.endpoint.(*NativeEndpoint) == nil {
- peer.mutex.RUnlock()
+ peer.RUnlock()
continue
}
if peer.endpoint.(*NativeEndpoint).isV6 || peer.endpoint.(*NativeEndpoint).src4().ifindex == 0 {
- peer.mutex.RUnlock()
+ peer.RUnlock()
break
}
nlmsg := struct {
@@ -730,14 +730,14 @@ func (bind *NativeBind) routineRouteListener(device *Device) {
endpoint: &peer.endpoint,
}
reqPeerLock.Unlock()
- peer.mutex.RUnlock()
+ peer.RUnlock()
i++
_, err := bind.netlinkCancel.Write((*[unsafe.Sizeof(nlmsg)]byte)(unsafe.Pointer(&nlmsg))[:])
if err != nil {
break
}
}
- device.peers.mutex.RUnlock()
+ device.peers.RUnlock()
}()
}
remain = remain[hdr.Len:]