From 6a128dde71d925fd4865ebd86855213a429b4729 Mon Sep 17 00:00:00 2001 From: "Jason A. Donenfeld" Date: Thu, 28 Jan 2021 15:26:22 +0100 Subject: device: do not allow get to run while set runs Signed-off-by: Jason A. Donenfeld --- device/device.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'device/device.go') diff --git a/device/device.go b/device/device.go index e769a20..c6b62ea 100644 --- a/device/device.go +++ b/device/device.go @@ -23,7 +23,6 @@ type Device struct { isUp AtomicBool // device is (going) up isClosed AtomicBool // device is closed? (acting as guard) log *Logger - ipcSetMu sync.Mutex // serializes UAPI set operations // synchronized resources (locks acquired in order) @@ -89,6 +88,8 @@ type Device struct { device tun.Device mtu int32 } + + ipcMutex sync.RWMutex } // An encryptionQueue is a channel of QueueOutboundElements awaiting encryption. -- cgit v1.2.3-54-g00ecf