mirror of https://github.com/golang/go.git
net: fix data race on fd.sysfd
Fixes #4369. Remove the check for fd.sysfd < 0, the first line of fd.accept() tests if the fd is open correctly and will handle the fd being closed during accept. R=dvyukov, bradfitz CC=golang-dev https://golang.org/cl/6843076
This commit is contained in:
parent
0bfece06d7
commit
c9856e7d22
|
|
@ -231,7 +231,7 @@ type TCPListener struct {
|
||||||
// AcceptTCP accepts the next incoming call and returns the new connection
|
// AcceptTCP accepts the next incoming call and returns the new connection
|
||||||
// and the remote address.
|
// and the remote address.
|
||||||
func (l *TCPListener) AcceptTCP() (c *TCPConn, err error) {
|
func (l *TCPListener) AcceptTCP() (c *TCPConn, err error) {
|
||||||
if l == nil || l.fd == nil || l.fd.sysfd < 0 {
|
if l == nil || l.fd == nil {
|
||||||
return nil, syscall.EINVAL
|
return nil, syscall.EINVAL
|
||||||
}
|
}
|
||||||
fd, err := l.fd.accept(sockaddrToTCP)
|
fd, err := l.fd.accept(sockaddrToTCP)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue