Fix darwin batch loop not exit on EBADF

This commit is contained in:
世界 2026-03-05 20:32:32 +08:00
parent 90ea7a0b69
commit c81ce6d358
No known key found for this signature in database
GPG key ID: CD109927C34A63C4
2 changed files with 5 additions and 2 deletions

View file

@ -269,7 +269,7 @@ func (s *System) batchLoopDarwin(darwinTUN DarwinTUN) {
for {
buffers, err := darwinTUN.BatchRead()
if err != nil {
if E.IsClosed(err) {
if E.IsClosed(err) || errors.Is(err, syscall.EBADF) {
return
}
s.logger.Error(E.Cause(err, "batch read packet"))