summaryrefslogtreecommitdiffhomepage
path: root/device
diff options
context:
space:
mode:
authorJosh Bleecher Snyder <josharian@gmail.com>2021-03-29 12:36:09 -0700
committerJosh Bleecher Snyder <josharian@gmail.com>2021-03-30 12:07:12 -0700
commit02e419ed8af63294fb0d9015d5c77b78fe92709e (patch)
tree119b729db4a71c75c9ece7511b7d69589f001bd9 /device
parentbc69a3fa60f74292bd3df7e11d406902ff785b79 (diff)
device: rename unsafeCloseBind to closeBindLocked
And document a bit. This name is more idiomatic. Signed-off-by: Josh Bleecher Snyder <josharian@gmail.com>
Diffstat (limited to 'device')
-rw-r--r--device/device.go8
1 files changed, 5 insertions, 3 deletions
diff --git a/device/device.go b/device/device.go
index 3b8770b..1e32db6 100644
--- a/device/device.go
+++ b/device/device.go
@@ -400,7 +400,9 @@ func (device *Device) SendKeepalivesToPeersWithCurrentKeypair() {
device.peers.RUnlock()
}
-func unsafeCloseBind(device *Device) error {
+// closeBindLocked closes the device's net.bind.
+// The caller must hold the net mutex.
+func closeBindLocked(device *Device) error {
var err error
netc := &device.net
if netc.netlinkCancel != nil {
@@ -455,7 +457,7 @@ func (device *Device) BindUpdate() error {
defer device.net.Unlock()
// close existing sockets
- if err := unsafeCloseBind(device); err != nil {
+ if err := closeBindLocked(device); err != nil {
return err
}
@@ -511,7 +513,7 @@ func (device *Device) BindUpdate() error {
func (device *Device) BindClose() error {
device.net.Lock()
- err := unsafeCloseBind(device)
+ err := closeBindLocked(device)
device.net.Unlock()
return err
}