]> git.ipfire.org Git - thirdparty/wireguard-go.git/commitdiff
Avoid deadlock when the mutex isn't required, since these are atomics
authorJason A. Donenfeld <Jason@zx2c4.com>
Sun, 20 May 2018 03:55:52 +0000 (05:55 +0200)
committerJason A. Donenfeld <Jason@zx2c4.com>
Sun, 20 May 2018 04:29:21 +0000 (06:29 +0200)
Maybe this fixes the "double lock issue" in
f73d2fb2d96bc3fbc8bc4cce452e3c19689de01e?

device.go

index 53e7dcc4de72874f91702e79e8d855d16d12b570..6758cbc73b2afb27549b446e9796b609766bba40 100644 (file)
--- a/device.go
+++ b/device.go
@@ -162,16 +162,12 @@ func (device *Device) Up() {
                return
        }
 
-       device.state.mutex.Lock()
        device.isUp.Set(true)
-       device.state.mutex.Unlock()
        deviceUpdateState(device)
 }
 
 func (device *Device) Down() {
-       device.state.mutex.Lock()
        device.isUp.Set(false)
-       device.state.mutex.Unlock()
        deviceUpdateState(device)
 }