summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2021-03-11 09:29:10 -0700
committerJason A. Donenfeld <Jason@zx2c4.com>2021-03-11 09:29:10 -0700
commit5f0c8b942d93be6ac36a156c0ba44c86c3698f91 (patch)
treea5498716da6fa50541baff7faddf2a30f74a9d37
parentc5f382624ee45df7b17e14800d361159eb924e6f (diff)
device: signal to close device in separate routine
Otherwise we wind up deadlocking. Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
-rw-r--r--device/send.go2
1 files changed, 1 insertions, 1 deletions
diff --git a/device/send.go b/device/send.go
index cb1607b..a437cf1 100644
--- a/device/send.go
+++ b/device/send.go
@@ -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)