1
0
mirror of https://git.zx2c4.com/wireguard-go synced 2024-11-15 01:05:15 +01:00

device: rename unsafeCloseBind to closeBindLocked

And document a bit.
This name is more idiomatic.

Signed-off-by: Josh Bleecher Snyder <josharian@gmail.com>
This commit is contained in:
Josh Bleecher Snyder 2021-03-29 12:36:09 -07:00
parent bc69a3fa60
commit 02e419ed8a

View File

@ -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
}