tun/netstack: ensure (*netTun).incomingPacket chan is closed

Without this, `device.Close()` will deadlock.

Signed-off-by: Colin Adler <[email protected]>
Signed-off-by: Jason A. Donenfeld <[email protected]>
This commit is contained in:
Colin Adler
2022-09-20 17:17:29 +02:00
committed by Jason A. Donenfeld
parent b51010ba13
commit fde0a9525a
+4
View File
@@ -164,6 +164,10 @@ func (tun *netTun) Close() error {
tun.ep.Close() tun.ep.Close()
if tun.incomingPacket != nil {
close(tun.incomingPacket)
}
return nil return nil
} }