]> git.ipfire.org Git - thirdparty/wireguard-go.git/commitdiff
device: signal to close device in separate routine
authorJason A. Donenfeld <Jason@zx2c4.com>
Thu, 11 Mar 2021 16:29:10 +0000 (09:29 -0700)
committerJason A. Donenfeld <Jason@zx2c4.com>
Thu, 11 Mar 2021 16:29:10 +0000 (09:29 -0700)
Otherwise we wind up deadlocking.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
device/send.go

index cb1607bd0329b22b92acaa765fd529627f232c5e..a437cf1239bda5a98097fe2d34dd1d6d8222abe3 100644 (file)
@@ -228,7 +228,7 @@ func (device *Device) RoutineReadFromTUN() {
                if err != nil {
                        if !device.isClosed() {
                                device.log.Errorf("Failed to read packet from TUN device: %v", err)
-                               device.Close()
+                               go device.Close()
                        }
                        device.PutMessageBuffer(elem.buffer)
                        device.PutOutboundElement(elem)