net: Check for EINTR.

From-SVN: r169309
This commit is contained in:
Ian Lance Taylor 2011-01-26 22:37:13 +00:00
parent dcf25f5973
commit 753e7b85bd

View File

@ -350,7 +350,7 @@ func (fd *netFD) Read(p []byte) (n int, err os.Error) {
for {
var errno int
n, errno = syscall.Read(fd.sysfile.Fd(), p)
if errno == syscall.EAGAIN && fd.rdeadline >= 0 {
if (errno == syscall.EAGAIN || errno == syscall.EINTR) && fd.rdeadline >= 0 {
pollserver.WaitRead(fd)
continue
}
@ -385,7 +385,7 @@ func (fd *netFD) ReadFrom(p []byte) (n int, sa syscall.Sockaddr, err os.Error) {
for {
var errno int
n, sa, errno = syscall.Recvfrom(fd.sysfd, p, 0)
if errno == syscall.EAGAIN && fd.rdeadline >= 0 {
if (errno == syscall.EAGAIN || errno == syscall.EINTR) && fd.rdeadline >= 0 {
pollserver.WaitRead(fd)
continue
}
@ -418,7 +418,7 @@ func (fd *netFD) ReadMsg(p []byte, oob []byte) (n, oobn, flags int, sa syscall.S
for {
var errno int
n, oobn, flags, sa, errno = syscall.Recvmsg(fd.sysfd, p, oob, 0)
if errno == syscall.EAGAIN && fd.rdeadline >= 0 {
if (errno == syscall.EAGAIN || errno == syscall.EINTR) && fd.rdeadline >= 0 {
pollserver.WaitRead(fd)
continue
}
@ -464,7 +464,7 @@ func (fd *netFD) Write(p []byte) (n int, err os.Error) {
if nn == len(p) {
break
}
if errno == syscall.EAGAIN && fd.wdeadline >= 0 {
if (errno == syscall.EAGAIN || errno == syscall.EINTR) && fd.wdeadline >= 0 {
pollserver.WaitWrite(fd)
continue
}
@ -500,7 +500,7 @@ func (fd *netFD) WriteTo(p []byte, sa syscall.Sockaddr) (n int, err os.Error) {
var oserr os.Error
for {
errno := syscall.Sendto(fd.sysfd, p, 0, sa)
if errno == syscall.EAGAIN && fd.wdeadline >= 0 {
if (errno == syscall.EAGAIN || errno == syscall.EINTR) && fd.wdeadline >= 0 {
pollserver.WaitWrite(fd)
continue
}
@ -534,7 +534,7 @@ func (fd *netFD) WriteMsg(p []byte, oob []byte, sa syscall.Sockaddr) (n int, oob
for {
var errno int
errno = syscall.Sendmsg(fd.sysfd, p, oob, sa, 0)
if errno == syscall.EAGAIN && fd.wdeadline >= 0 {
if (errno == syscall.EAGAIN || errno == syscall.EINTR) && fd.wdeadline >= 0 {
pollserver.WaitWrite(fd)
continue
}
@ -572,7 +572,7 @@ func (fd *netFD) accept(toAddr func(syscall.Sockaddr) Addr) (nfd *netFD, err os.
return nil, os.EINVAL
}
s, sa, e = syscall.Accept(fd.sysfd)
if e != syscall.EAGAIN {
if e != syscall.EAGAIN && e != syscall.EINTR {
break
}
syscall.ForkLock.RUnlock()