Fixed a bug related to EINTR.
parent
816f77d732
commit
4de334e034
|
@ -232,15 +232,27 @@ func (c *Connection) readMessage() (m *buffer.InMessage, err error) {
|
||||||
err = m.Init(c.wrapped.Dev)
|
err = m.Init(c.wrapped.Dev)
|
||||||
c.wrapped.Rio.RUnlock()
|
c.wrapped.Rio.RUnlock()
|
||||||
|
|
||||||
|
// Special cases:
|
||||||
|
//
|
||||||
|
// * ENODEV means fuse has hung up.
|
||||||
|
//
|
||||||
|
// * EINTR means we should try again. (This seems to happen often on
|
||||||
|
// OS X, cf. http://golang.org/issue/11180)
|
||||||
|
//
|
||||||
|
if pe, ok := err.(*os.PathError); ok {
|
||||||
|
switch pe.Err {
|
||||||
|
case syscall.ENODEV:
|
||||||
|
err = io.EOF
|
||||||
|
|
||||||
|
case syscall.EINTR:
|
||||||
|
err = nil
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
c.destroyInMessage(m)
|
c.destroyInMessage(m)
|
||||||
m = nil
|
m = nil
|
||||||
|
|
||||||
// Special case: ENODEV means fuse has hung up.
|
|
||||||
if pe, ok := err.(*os.PathError); ok && pe.Err == syscall.ENODEV {
|
|
||||||
err = io.EOF
|
|
||||||
}
|
|
||||||
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue