diff options
author | Josh Bleecher Snyder <josh@tailscale.com> | 2021-01-25 09:32:09 -0800 |
---|---|---|
committer | Josh Bleecher Snyder <josh@tailscale.com> | 2021-01-25 09:37:28 -0800 |
commit | a9ce4b762cd8b9898ff69571194ad3f09ad6d7bd (patch) | |
tree | 3786d62dbea48dabb5da2778e1aa8c633b7159ed /device | |
parent | d8f2cc87ee66958226157c5bb77464eee23156c2 (diff) |
device: simplify handling of IPC set endpoint
Signed-off-by: Josh Bleecher Snyder <josh@tailscale.com>
Diffstat (limited to 'device')
-rw-r--r-- | device/uapi.go | 16 |
1 files changed, 4 insertions, 12 deletions
diff --git a/device/uapi.go b/device/uapi.go index 196b359..bf38459 100644 --- a/device/uapi.go +++ b/device/uapi.go @@ -301,21 +301,13 @@ func (device *Device) handlePeerLine(peer *ipcSetPeer, key, value string) error case "endpoint": device.log.Debug.Println(peer, "- UAPI: Updating endpoint") - - err := func() error { - peer.Lock() - defer peer.Unlock() - endpoint, err := conn.CreateEndpoint(value) - if err != nil { - return err - } - peer.endpoint = endpoint - return nil - }() - + endpoint, err := conn.CreateEndpoint(value) if err != nil { return ipcErrorf(ipc.IpcErrorInvalid, "failed to set endpoint %v: %w", value, err) } + peer.Lock() + defer peer.Unlock() + peer.endpoint = endpoint case "persistent_keepalive_interval": device.log.Debug.Println(peer, "- UAPI: Updating persistent keepalive interval") |