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:
parent
c5f382624e
commit
5f0c8b942d
@ -228,7 +228,7 @@ func (device *Device) RoutineReadFromTUN() {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
if !device.isClosed() {
|
if !device.isClosed() {
|
||||||
device.log.Errorf("Failed to read packet from TUN device: %v", err)
|
device.log.Errorf("Failed to read packet from TUN device: %v", err)
|
||||||
device.Close()
|
go device.Close()
|
||||||
}
|
}
|
||||||
device.PutMessageBuffer(elem.buffer)
|
device.PutMessageBuffer(elem.buffer)
|
||||||
device.PutOutboundElement(elem)
|
device.PutOutboundElement(elem)
|
||||||
|
Loading…
Reference in New Issue
Block a user