diff options
author | ian <ian@138bc75d-0d04-0410-961f-82ee72b054a4> | 2011-09-16 15:47:21 +0000 |
---|---|---|
committer | ian <ian@138bc75d-0d04-0410-961f-82ee72b054a4> | 2011-09-16 15:47:21 +0000 |
commit | 49b4e44b7d540fa846d353b10237848a67789cbf (patch) | |
tree | ea2b52e3c258d6b6d9356977c683c7f72a4a5fd5 /libgo/go/net/fd.go | |
parent | 82ceb8f6a88a0193971f53e0571e017f2764f7d7 (diff) | |
download | gcc-49b4e44b7d540fa846d353b10237848a67789cbf.tar.gz |
Update Go library to r60.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@178910 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libgo/go/net/fd.go')
-rw-r--r-- | libgo/go/net/fd.go | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/libgo/go/net/fd.go b/libgo/go/net/fd.go index cd1a21dc361..707dccaa421 100644 --- a/libgo/go/net/fd.go +++ b/libgo/go/net/fd.go @@ -585,20 +585,25 @@ func (fd *netFD) accept(toAddr func(syscall.Sockaddr) Addr) (nfd *netFD, err os. fd.incref() defer fd.decref() + if fd.rdeadline_delta > 0 { + fd.rdeadline = pollserver.Now() + fd.rdeadline_delta + } else { + fd.rdeadline = 0 + } // See ../syscall/exec.go for description of ForkLock. // It is okay to hold the lock across syscall.Accept // because we have put fd.sysfd into non-blocking mode. syscall.ForkLock.RLock() var s, e int - var sa syscall.Sockaddr + var rsa syscall.Sockaddr for { if fd.closing { syscall.ForkLock.RUnlock() return nil, os.EINVAL } - s, sa, e = syscall.Accept(fd.sysfd) - if e != syscall.EAGAIN { + s, rsa, e = syscall.Accept(fd.sysfd) + if e != syscall.EAGAIN || fd.rdeadline < 0 { break } syscall.ForkLock.RUnlock() @@ -616,7 +621,8 @@ func (fd *netFD) accept(toAddr func(syscall.Sockaddr) Addr) (nfd *netFD, err os. syscall.Close(s) return nil, err } - nfd.setAddr(fd.laddr, toAddr(sa)) + lsa, _ := syscall.Getsockname(nfd.sysfd) + nfd.setAddr(toAddr(lsa), toAddr(rsa)) return nfd, nil } |