use shutdown

This commit is contained in:
JackDoan
2026-01-28 13:21:51 -06:00
parent 1584dca21c
commit 13f8f0c308
2 changed files with 3 additions and 24 deletions

View File

@@ -505,20 +505,12 @@ func (f *Interface) Close() error {
f.l.WithError(err).Error("Error while closing udp socket")
}
}
for i, r := range f.readers {
if i == 0 {
continue // f.readers[0] is f.inside, which we want to save for last
}
if err := r.Close(); err != nil {
f.l.WithError(err).Error("Error while closing tun reader")
}
}
// Release the tun readers
for _, u := range f.readers {
for i, u := range f.readers {
err := u.Close()
if err != nil {
f.l.WithError(err).Error("Error while closing tun device")
f.l.WithError(err).WithField("i", i).Error("Error while closing tun device")
}
}