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:
committed by
Jason A. Donenfeld
parent
b51010ba13
commit
fde0a9525a
@@ -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
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user