1
0
mirror of https://github.com/golang/go synced 2024-11-23 09:30:03 -07:00

net: document that File reverts connection to blocking mode.

Fixes #2458.

R=mikioh.mikioh, rsc
CC=golang-dev
https://golang.org/cl/6869054
This commit is contained in:
Rick Arnold 2012-12-05 23:31:35 -05:00 committed by Russ Cox
parent 82f2b36e74
commit 5416e6e916

View File

@ -197,9 +197,13 @@ func (c *conn) SetWriteBuffer(bytes int) error {
return setWriteBuffer(c.fd, bytes) return setWriteBuffer(c.fd, bytes)
} }
// File returns a copy of the underlying os.File, set to blocking mode. // File sets the underlying os.File to blocking mode and returns a copy.
// It is the caller's responsibility to close f when finished. // It is the caller's responsibility to close f when finished.
// Closing c does not affect f, and closing f does not affect c. // 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.
func (c *conn) File() (f *os.File, err error) { return c.fd.dup() } func (c *conn) File() (f *os.File, err error) { return c.fd.dup() }
// An Error represents a network error. // An Error represents a network error.