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

device: signal to close device in separate routine

Otherwise we wind up deadlocking.

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
This commit is contained in:
Jason A. Donenfeld 2021-03-11 09:29:10 -07:00
parent c5f382624e
commit 5f0c8b942d

View 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)