mirror of https://github.com/tidwall/evio.git
Fixed hang on detach closed
This commit is contained in:
parent
67a98f8d46
commit
ea610eff86
13
evio_unix.go
13
evio_unix.go
|
@ -7,6 +7,7 @@
|
|||
package evio
|
||||
|
||||
import (
|
||||
"io"
|
||||
"net"
|
||||
"os"
|
||||
"runtime"
|
||||
|
@ -458,7 +459,17 @@ func (c *detachedConn) Close() error {
|
|||
}
|
||||
|
||||
func (c *detachedConn) Read(p []byte) (n int, err error) {
|
||||
return syscall.Read(c.fd, p)
|
||||
n, err = syscall.Read(c.fd, p)
|
||||
if err != nil {
|
||||
return n, err
|
||||
}
|
||||
if n == 0 {
|
||||
if len(p) == 0 {
|
||||
return 0, nil
|
||||
}
|
||||
return 0, io.EOF
|
||||
}
|
||||
return n, nil
|
||||
}
|
||||
|
||||
func (c *detachedConn) Write(p []byte) (n int, err error) {
|
||||
|
|
Loading…
Reference in New Issue