tun: windows: delete interface before deleting file handles
This commit is contained in:
parent
2faf2dcf90
commit
52ec440d79
@ -214,18 +214,13 @@ func (tun *NativeTun) Events() chan TUNEvent {
|
|||||||
|
|
||||||
func (tun *NativeTun) Close() error {
|
func (tun *NativeTun) Close() error {
|
||||||
tun.close = true
|
tun.close = true
|
||||||
err1 := tun.closeTUN()
|
|
||||||
|
|
||||||
if tun.events != nil {
|
if tun.events != nil {
|
||||||
close(tun.events)
|
close(tun.events)
|
||||||
}
|
}
|
||||||
|
/* We delete it first, before closing, so that the close operations don't hang with the concurrent read operation. */
|
||||||
_, _, err2 := tun.wt.DeleteInterface(0)
|
_, _, err := tun.wt.DeleteInterface(0)
|
||||||
if err1 == nil {
|
tun.closeTUN()
|
||||||
err1 = err2
|
return err
|
||||||
}
|
|
||||||
|
|
||||||
return err1
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (tun *NativeTun) MTU() (int, error) {
|
func (tun *NativeTun) MTU() (int, error) {
|
||||||
|
Loading…
Reference in New Issue
Block a user