Fix darwin batch read not exit on stop
This commit is contained in:
parent
9d97d95a9c
commit
2f53768be2
1 changed files with 7 additions and 1 deletions
|
|
@ -158,7 +158,10 @@ func (t *NativeTun) Close() error {
|
|||
return t.tunFile.Close()
|
||||
}
|
||||
defer flushDNSCache()
|
||||
return E.Errors(t.unsetRoutes(), t.tunFile.Close())
|
||||
t.stopFd.Stop()
|
||||
err := E.Errors(t.unsetRoutes(), t.tunFile.Close())
|
||||
t.stopFd.Close()
|
||||
return err
|
||||
}
|
||||
|
||||
func (t *NativeTun) Read(p []byte) (n int, err error) {
|
||||
|
|
@ -356,6 +359,9 @@ func (t *NativeTun) BatchRead() ([]*buf.Buffer, error) {
|
|||
t.buffers = t.buffers[:0]
|
||||
return nil, errno
|
||||
}
|
||||
if n < 0 {
|
||||
return nil, os.ErrClosed
|
||||
}
|
||||
if n < 1 {
|
||||
return nil, nil
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue