aboutsummaryrefslogtreecommitdiffstats
path: root/conn.go
diff options
context:
space:
mode:
Diffstat (limited to 'conn.go')
-rw-r--r--conn.go28
1 files changed, 14 insertions, 14 deletions
diff --git a/conn.go b/conn.go
index c3fcf91..b19a9c2 100644
--- a/conn.go
+++ b/conn.go
@@ -78,8 +78,8 @@ func unsafeCloseBind(device *Device) error {
func (device *Device) BindSetMark(mark uint32) error {
- device.net.mutex.Lock()
- defer device.net.mutex.Unlock()
+ device.net.Lock()
+ defer device.net.Unlock()
// check if modified
@@ -98,23 +98,23 @@ func (device *Device) BindSetMark(mark uint32) error {
// clear cached source addresses
- device.peers.mutex.RLock()
+ device.peers.RLock()
for _, peer := range device.peers.keyMap {
- peer.mutex.Lock()
- defer peer.mutex.Unlock()
+ peer.Lock()
+ defer peer.Unlock()
if peer.endpoint != nil {
peer.endpoint.ClearSrc()
}
}
- device.peers.mutex.RUnlock()
+ device.peers.RUnlock()
return nil
}
func (device *Device) BindUpdate() error {
- device.net.mutex.Lock()
- defer device.net.mutex.Unlock()
+ device.net.Lock()
+ defer device.net.Unlock()
// close existing sockets
@@ -148,15 +148,15 @@ func (device *Device) BindUpdate() error {
// clear cached source addresses
- device.peers.mutex.RLock()
+ device.peers.RLock()
for _, peer := range device.peers.keyMap {
- peer.mutex.Lock()
- defer peer.mutex.Unlock()
+ peer.Lock()
+ defer peer.Unlock()
if peer.endpoint != nil {
peer.endpoint.ClearSrc()
}
}
- device.peers.mutex.RUnlock()
+ device.peers.RUnlock()
// start receiving routines
@@ -173,8 +173,8 @@ func (device *Device) BindUpdate() error {
}
func (device *Device) BindClose() error {
- device.net.mutex.Lock()
+ device.net.Lock()
err := unsafeCloseBind(device)
- device.net.mutex.Unlock()
+ device.net.Unlock()
return err
}