net: calling File leaves the socket in nonblocking mode

On Unix systems, the underlying socket is no longer forced into blocking
mode.

Fixes #24942

Change-Id: I3e0c503c72df0844e30a63af298691dedacd1f46
Reviewed-on: https://go-review.googlesource.com/108297
Run-TryBot: Ian Lance Taylor <iant@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Ian Lance Taylor <iant@golang.org>
diff --git a/src/net/fd_unix.go b/src/net/fd_unix.go
index efe2e18..145933e 100644
--- a/src/net/fd_unix.go
+++ b/src/net/fd_unix.go
@@ -309,13 +309,5 @@
 		return nil, err
 	}
 
-	// We want blocking mode for the new fd, hence the double negative.
-	// This also puts the old fd into blocking mode, meaning that
-	// I/O will block the thread instead of letting us use the epoll server.
-	// Everything will still work, just with more threads.
-	if err = fd.pfd.SetBlocking(); err != nil {
-		return nil, os.NewSyscallError("setnonblock", err)
-	}
-
 	return os.NewFile(uintptr(ns), fd.name()), nil
 }
diff --git a/src/net/net.go b/src/net/net.go
index 5182c0d..b023d7c 100644
--- a/src/net/net.go
+++ b/src/net/net.go
@@ -281,15 +281,13 @@
 	return nil
 }
 
-// File sets the underlying os.File to blocking mode and returns a copy.
+// File returns a copy of the underlying os.File
 // It is the caller's responsibility to close f when finished.
 // Closing c does not affect f, and closing f does not affect c.
 //
 // The returned os.File's file descriptor is different from the connection's.
 // Attempting to change properties of the original using this duplicate
 // may or may not have the desired effect.
-//
-// On Unix systems this will cause the SetDeadline methods to stop working.
 func (c *conn) File() (f *os.File, err error) {
 	f, err = c.fd.dup()
 	if err != nil {
diff --git a/src/net/tcpsock.go b/src/net/tcpsock.go
index 9528140..0421ce5 100644
--- a/src/net/tcpsock.go
+++ b/src/net/tcpsock.go
@@ -292,8 +292,8 @@
 	return nil
 }
 
-// File returns a copy of the underlying os.File, set to blocking
-// mode. It is the caller's responsibility to close f when finished.
+// File returns a copy of the underlying os.File.
+// It is the caller's responsibility to close f when finished.
 // Closing l does not affect f, and closing f does not affect l.
 //
 // The returned os.File's file descriptor is different from the
diff --git a/src/net/unixsock.go b/src/net/unixsock.go
index 20326da..551280f 100644
--- a/src/net/unixsock.go
+++ b/src/net/unixsock.go
@@ -286,8 +286,8 @@
 	return nil
 }
 
-// File returns a copy of the underlying os.File, set to blocking
-// mode. It is the caller's responsibility to close f when finished.
+// File returns a copy of the underlying os.File.
+// It is the caller's responsibility to close f when finished.
 // Closing l does not affect f, and closing f does not affect l.
 //
 // The returned os.File's file descriptor is different from the